Reputation: 1849
I'm getting this error when I push to Heroku:
Running: rake assets:precompile
rake aborted!
You did not provide both required access keys. Please provide the access_key_id and the secret_access_key.
but, my keys are there
$ heroku config
AMAZON_ACCESS_KEY_ID => SOMethingSecRET
AMAZON_SECRET_ACCESS_KEY => EVENmoreSecret/sTuff//PASSworD
and my S3 connection is defined in config/initializer/s3.rb
AWS::S3::Base.establish_connection!(
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
)
Yet Heroku somehow REFUSES to read them. Even heroku's own docs tell you to do it this way: http://devcenter.heroku.com/articles/config-vars I've literally read through and tried all of the suggested "solutions" on here about getting Heroku to read s3 access keys, but they all deal with Paperclip and none require an initializer.
Relevant info: Rails 3.1, Cedar Stack
What the hell Heroku?
Upvotes: 1
Views: 307
Reputation: 22240
If you're getting this error during the deploy process, this is because the slug compilers don't have access to your environment (where your config vars are set).
There's two options:
1) Make the asset precompile code fail silently and run it once the deploy is complete and your environment is available.
2) Use the user_env_compile lab add-on
$ heroku plugins:install http://github.com/heroku/heroku-labs.git
$ heroku labs:enable user_env_compile -a myapp
-----> Enabling user_env_compile for myapp... done
WARNING: This feature is experimental and may change or be removed without notice.
Upvotes: 3