Errno::ENOENT (No such file or directory @ rb_sysopen - aws.yml) in rails with paperclip

1.4k views Asked by At

Rais application deployed in aws elastic beantalk. Images are not loading from assets folder. I am trying to use s3 bucket to store assets. I got an error...

aws.yml

 production:
  access_key_id: 123333231331....
  secret_access_key: 12212dddddd........

production.rb

  config.paperclip_defaults = {
  :storage => :s3,
  :preserve_files => true,
  :s3_credentials => 'aws.yml',
  :s3_region => 'ap-south-1',
  :s3_host_name => 's3.ap-south-1.amazonaws.com',
  :bucket => 'xxxxxx'
}

I also give public access permissions in s3 bucket.

anyone: read write

gem...

gem 'aws-sdk', '~> 2.10', '>= 2.10.85'

aws.yml folder within config folder -- config/aws.yml

1

There are 1 answers

1
SRack On BEST ANSWER

Have you tried using the path to the file, as at the bottom of your question: :s3_credentials => 'config/aws.yml'.

Otherwise, you might need to explicitly load the file from YAML and pass this in:

require 'yaml'
...
# again, perhaps using config/aws.yml, have a play
:s3_credentials => YAML.load_file('aws.yml')
...

Either of those help?