1

I use aws-sdk-core (3.59.0), aws-sdk-s3 (1.45.0) and paperclip (6.1.0).

Here is also my S3 configs:

config.paperclip_defaults = {
      storage: :s3,
      s3_region: Rails.application.secrets.s3_region,
      bucket: Rails.application.secrets.s3_bucket_name,
      s3_credentials: {
        access_key_id: Rails.application.secrets.aws_access_key_id,
        secret_access_key: Rails.application.secrets.aws_secret_access_key
      },
      s3_protocol: 'https',
      s3_host_name: "s3-#{Rails.application.secrets.s3_region}.amazonaws.com",
      path: '/:class/:attachment/:id_partition/:style/:filename'
    }

And getting Aws::S3::Errors::InvalidArgument. Tried multiple options but could not find solution.

I found that it relates to s3_permissions:

has_attached_file :curriculum_vitae,
    styles: {
      pdf: { format: 'pdf', processors: [:to_pdf] },
      thumb: ["105x148>",:png]
    },
    s3_permissions: :authenticated_read

If I remove it exception doesn't appear. But as I see it's according to the documentation.

Thanks for any advice.

1 Answers1

0

Found that s3_permissions: 'authenticated_read' fixes the issue.