Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Key is there but I still get `fetch': key not found: "S3_BUCKET_NAME" (KeyError)

I know there's a ton of these asked, but I've tried to follow each one with no luck. There must be some easy mistake that I am overlooking.

I'm trying to set up S3 and Paperclip following the Heroku guide and set up local testing following this Words and Code guide. Every time I try to generate a db migration though I get the error:

config/environments/development.rb:62:in fetch': key not found: "S3_BUCKET_NAME" (KeyError)

These are my files exactly with keys replaced:

development.rb

config.paperlip_defaults = {
    storage: :s3,
    s3_credientials: {
      bucket: ENV.fetch('S3_BUCKET_NAME'),
      access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
      secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
      s3_region: ENV.fetch('AWS_REGION')
    }
  }

.ENV

S3_BUCKET_NAME=some-bucket-name
AWS_ACCESS_KEY_ID=AAAAAABBBBBCCCCCDDDD
AWS_SECRET_ACCESS_KEY=AAAAABBBBBCCCCCDDDDDEEEEE
AWS_REGION=us-east-1

What am I missing?

Edit: I have tried adding the ENV values to my ~/.bashrc and ~/.bash_profle as suggested in this question, with the same error.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The answer turned out to be pretty easy with a gem.

I added dotenv-rails to my gemfile

group :development, :test do
  gem 'dotenv-rails'
end

bundle install and good to go.

I guess I never realized that the .env file saved in the root directory wasn't loaded automatically.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!