0

I am using the kreeti/kt-paperclip gem with rails 4.2 and MinIO. I believe I have setup the model correctly, but I am getting "Aws::S3::Errors::InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records." I have tests verifying the path and the credentials. I am wondering if the gem is using my local MinIO server or is trying to access AWS. Is there a way short of using a packet sniffer to verify that it is attempting to use the correct S3 service?

has_attached_file :attachment, path: "submission/attachments/:id/:basename.:extension",
    storage: :s3, s3_credentials: Proc.new{|a| a.instance.s3_credentials }, url: ":s3_path_url"
def s3_credentials
    {
      bucket: "bucket_name",
      access_key_id: "MYKEY",
      secret_access_key: "MYSECRET,
      s3_region: "us-west-1",
      s3_protocol: "http",
      s3_host_name: "play.minio.io:9000"
    }
  end
J Edward Ellis
  • 1,368
  • 2
  • 12
  • 21

1 Answers1

0

I stumbled across the answer on the MinIO documentation web site. https://docs.min.io/docs/how-to-use-paperclip-with-minio-server.html

First I was putting options into the credentials, which is not right. Plus there are additional options.

  has_attached_file :attachment,
                    storage: :s3,
                    s3_protocol: ':http',
                    s3_permissions: 'public',
                    s3_region: 'us-west-1',
                    s3_credentials: {
                      bucket: 'bucket_name',
                      access_key_id: 'MYKEY',
                      secret_access_key: 'MYSECRET',
                    },
                    s3_host_name: 'play.minio.io:9000',
                    s3_options: {
                      endpoint: "http://play.minio.io:9000",
                      force_path_style: true
                    },
                    url: ":s3_path_url",
                    path: "submission/attachments/:id/:basename.:extension"
J Edward Ellis
  • 1,368
  • 2
  • 12
  • 21