2

This is my first post on this topic so please be gentle, but I'm getting a Keyerror when running my app rakefile. Any ideas?

MacBook-Pro:proleaderboard aidenhowes$ git push heroku master
Counting objects: 757, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (293/293), done.
Writing objects: 100% (757/757), 334.41 KiB | 0 bytes/s, done.
Total 757 (delta 419), reused 739 (delta 409)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path                     vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        Fetching source index from https://rubygems.org/
remote:        Fetching source index from https://rails-assets.org/
remote:        Fetching git://github.com/thoughtbot/paperclip.git
remote:        Fetching gem metadata from https://rails-assets.org/...
remote:        Fetching version metadata from https://rails-assets.org/..
remote:        Fetching git://github.com/mislav/will_paginate.git
remote:        Fetching git://github.com/bootstrap-ruby/will_paginate-    bootstrap.git
remote:        Installing rake 11.1.2
remote:        Installing concurrent-ruby 1.0.2
remote:        Installing i18n 0.7.0
remote:        Installing minitest 5.8.4
remote:        Installing thread_safe 0.3.5
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing json 1.8.3 with native extensions
remote:        Installing nio4r 1.2.1 with native extensions
remote:        Installing websocket-extensions 0.1.2
remote:        Installing mime-types-data 3.2016.0221
remote:        Installing arel 7.0.0
remote:        Installing execjs 2.6.0
remote:        Installing json_pure 1.8.3
remote:        Installing bcrypt 3.1.11 with native extensions
remote:        Installing sass 3.4.22
remote:        Installing callsite 0.0.11
remote:        Installing chartkick 1.5.2
remote:        Installing coffee-script-source 1.10.0
remote:        Installing method_source 0.8.2
remote:        Installing thor 0.19.1
remote:        Installing orm_adapter 0.5.0
remote:        Installing multi_xml 0.5.5
remote:        Installing multi_json 1.12.0
remote:        Installing turbolinks-source 5.0.0.beta4
remote:        Installing mimemagic 0.3.1
remote:        Using bundler 1.11.2
remote:        Installing puma 3.4.0 with native extensions
remote:        Installing rails-assets-tether 1.3.2
remote:        Installing pg 0.18.4 with native extensions
remote:        Installing rails_serve_static_assets 0.0.5
remote:        Installing rails_stdout_logging 0.0.5
remote:        Using will_paginate 3.1.0 from git://github.com/mislav/will_paginate.git (at master@5d92ee2)
remote:        Installing tilt 2.0.2
remote:        Installing yard 0.8.7.6
remote:        Installing faker 1.6.3
remote:        Installing tzinfo 1.2.2
remote:        Installing nokogiri 1.6.7.2 with native extensions
remote:        Installing websocket-driver 0.6.3 with native extensions
remote:        Installing mime-types 3.0
remote:        Installing autoprefixer-rails 6.3.6
remote:        Installing uglifier 3.0.0
remote:        Installing jmespath 1.2.4
remote:        Installing coffee-script 2.4.1
remote:        Installing rack 2.0.0.rc1
remote:        Installing httparty 0.13.7
remote:        Installing turbolinks 5.0.0.beta2
remote:        Installing rails_12factor 0.0.3
remote:        Installing activesupport 5.0.0.rc1
remote:        Using will_paginate-bootstrap 1.0.1 from git://github.com/bootstrap-ruby/will_paginate-bootstrap.git (at master@5fb4867)
remote:        Installing bootstrap 4.0.0.alpha3
remote:        Installing mail 2.6.4
remote:        Installing aws-sdk-core 2.3.4
remote:        Installing warden 1.2.6
remote:        Installing rack-test 0.6.3
remote:        Installing rack-contrib 1.2.0
remote:        Installing rails-deprecated_sanitizer 1.0.3
remote:        Installing sprockets 3.6.0
remote:        Installing globalid 0.3.6
remote:        Installing activemodel 5.0.0.rc1
remote:        Installing climate_control 0.0.3
remote:        Installing groupdate 2.5.3
remote:        Installing jbuilder 2.4.1
remote:        Installing loofah 2.0.3
remote:        Installing aws-sdk-resources 2.3.4
remote:        Installing rails-dom-testing 1.0.7
remote:        Installing activejob 5.0.0.rc1
remote:        Installing activerecord 5.0.0.rc1
remote:        Installing cocaine 0.5.8
remote:        Using paperclip 5.0.0.beta2 from git://github.com/thoughtbot/paperclip.git (at master@2c59f96)
remote:        Installing rails-html-sanitizer 1.0.3
remote:        Installing aws-sdk 2.3.4
remote:        Installing actionview 5.0.0.rc1
remote:        Installing actionpack 5.0.0.rc1
remote:        Installing actionmailer 5.0.0.rc1
remote:        Installing actioncable 5.0.0.rc1
remote:        Installing railties 5.0.0.rc1
remote:        Installing sprockets-rails 3.0.4
remote:        Installing responders 2.2.0
remote:        Installing coffee-rails 4.1.1
remote:        Installing font-awesome-rails 4.6.2.0
remote:        Installing jquery-turbolinks 2.1.0
remote:        Installing jquery-rails 4.1.1
remote:        Installing meta_request 0.4.0
remote:        Installing jquery-ui-rails 5.0.5
remote:        Installing rails 5.0.0.rc1
remote:        Installing sass-rails 5.0.4
remote:        Installing devise 4.0.2
remote:        Bundle complete! 38 Gemfile dependencies, 89 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Post-install message from httparty:
remote:        When you HTTParty, you must party hard!
remote:        Post-install message from paperclip:
remote:        ##################################################
remote:        #  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER       #
remote:        ##################################################
remote:        Paperclip is now compatible with aws-sdk >= 2.0.0.
remote:        If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
remote:        changes:
remote:        * You must set the `s3_region`
remote:        * If you are explicitly setting permissions anywhere, such as in an initializer,
remote:        note that the format of the permissions changed from using an underscore to
remote:        using a hyphen. For example, `:public_read` needs to be changed to
remote:        `public-read`.
remote:        For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
remote:        http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
remote:        Bundle completed (54.79s)
remote:        Cleaning up the bundler cache.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        KeyError: key not found: "S3_BUCKET_NAME"
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:92:in `fetch'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:92:in `block in <top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/railtie.rb:209:in `instance_eval'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/railtie.rb:209:in `configure'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environments/production.rb:1:in `<top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `block in require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:259:in `load_dependency'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:599:in `each'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/engine.rb:599:in `block in <class:Engine>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:55:in `block in run_initializers'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:44:in `each'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:44:in `tsort_each_child'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/initializable.rb:54:in `run_initializers'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:352:in `initialize!'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/config/environment.rb:5:in `<top (required)>'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `block in require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:259:in `load_dependency'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:328:in `require_environment!'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.rc1/lib/rails/application.rb:448:in `block in run_tasks_blocks'
remote:        /tmp/build_ede61efdc5705c0b3b467412e52dba8a/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to proleaderboard.
remote: 
To https://git.heroku.com/proleaderboard.git
! [remote rejected] master -> master (pre-receive hook declined)
4
  • 1
    Welcome to Stackoverflow and be more specific about your question. Avoid posting a bunch of error logs. Research a bit and then post the logs which describes your problem to get faster response. Commented May 24, 2016 at 15:34
  • Looks like the problem is in your configuration for your S3 bucket (KeyError: key not found: "S3_BUCKET_NAME"). Did you get your bucket name from your aws account and include it during configuration? Commented May 25, 2016 at 12:17
  • This is the reference to the S3 in the production.rb file. Is this where the details should be hardcoded? # Amazon Web Services config.paperclip_defaults = { storage: :s3, s3_credentials: { 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'), Commented May 25, 2016 at 13:28
  • @Aiden I am running into the same issue, and I have all of this in my production.rb file. Any thoughts as to why it isn't recognizing it? if i run heroku config it has all of it listed there. and the set up works fine (things are being saved into S3). I just cant precompile any more assets now Commented Sep 23, 2016 at 15:20

1 Answer 1

1

You need to set S3_BUCKET_NAME environment variable on Heroku.

On CUI you can heroku config:set S3_BUCKET_NAME=name_of_bucket

On GUI you can go to your Heroku app's Settings tab, and Reveal Config Vars and save whatever variables you need.

I recommend setting variables on CUI, because I had an issue that some variables are somehow not loaded, and re-setting of variable on CUI solved problem.

Sign up to request clarification or add additional context in comments.

1 Comment

I was having this issue for FB_API_KEY even though I had already set the config value using the Heroku Dashboard -> Settings GUI. When I pushed the values up from the command line the next 'git push heroku master' was able to precompile with no issue. Thank You!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.