I got this error suddenly after it was working when I open some of the pdf files
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>cases/invoices/000/000/322/original/ACF267A1-1089-4B2A-8384-6A2A9974AC59.jpeg</Key>
<RequestId>AWHEBB10M1Y7REGC</RequestId>
<HostId>ZDoitl0C4tLuijlOuKsATgShbbw6QSA3lU7Ju8ScV9ikUPmTFfTi0gOdcW9rm5rKoRWHN0Om0AM=</HostId>
</Error>
And when I check the aws amazon s3 bucket I notice that theres extra hidden files when I switch the version to true and inside it the files that giving me error
for example here is the link of the file in my website http://mobileimplantlab.s3.amazonaws.com/cases/invoices/000/000/322/original/ACF267A1-1089-4B2A-8384-6A2A9974AC59.jpeg?1666673349
and here is the link in amazon https://mobileimplantlab.s3.us-west-2.amazonaws.com/cases/invoices/000/000/322/original/ACF267A1-1089-4B2A-8384-6A2A9974AC59.jpeg?versionId=tejD03_M2GYRZ7yfy.diAa28RN4JqmMV
in the model inside case.rb
has_attached_file :invoice
validates_attachment :invoice, :content_type => { :content_type => %w(image/jpeg image/jpg image/png application/pdf application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document) }
in paperclip.rb
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
in gemfile
gem 'paperclip'
gem 'aws-sdk-s3'
gem 'aws-sdk', '< 2.0'
in development and production.rb
config.paperclip_defaults = {
storage: :s3,
s3_credentials: {
bucket: 'mobileimplantlab',
access_key_id: 'access key',
secret_access_key: 'secret key',
s3_region: 'us-west-2',
}
}
What I am doing wrong?
I cant find the solution anywhere here