Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda