いつもお世話になっております。  
現在`git push heroku master`を実行した時のエラーについて思考しております。

開発環境としては->Mac, AWSCloud9(Chromeがブラウザ), heroku です。

`$ git push heroku master`を実行すると

```

    （省略)
    To https://git.heroku.com/polar-hamlet-12140.git
    
     ! [remote rejected] master -> master (pre-receive hook declined)
    
    error: failed to push some refs to 'https://git.heroku.com/polar-hamlet-12140.git'
    
```

というエラーが出てしまうというものです。

省略している部分は下に記しています(長くなります)。

```

    ec2-user:~/environment/sample_app (master) $  git push heroku master
    Counting objects: 159, done.
    Compressing objects: 100% (152/152), done.
    Writing objects: 100% (159/159), 27.66 KiB | 944.00 KiB/s, done.
    Total 159 (delta 82), reused 0 (delta 0)
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Ruby app detected
    remote: -----> Compiling Ruby/Rails
    remote: -----> Using Ruby version: ruby-2.3.4
    remote: -----> Installing dependencies using bundler 1.15.2
    remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
    remote:        Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
    remote:        Fetching gem metadata from https://rubygems.org/.......
    remote:        Fetching version metadata from https://rubygems.org/..
    remote:        Fetching dependency metadata from https://rubygems.org/.
    remote:        Using rake 12.3.0
    remote:        Fetching CFPropertyList 2.3.6
    remote:        Using concurrent-ruby 1.0.5
    remote:        Using minitest 5.11.3
    remote:        Using thread_safe 0.3.6
    remote:        Using builder 3.2.3
    remote:        Using erubi 1.7.0
    remote:        Using mini_portile2 2.3.0
    remote:        Using crass 1.0.3
    remote:        Using rack 2.0.4
    remote:        Using nio4r 2.2.0
    remote:        Using websocket-extensions 0.1.3
    remote:        Using mini_mime 1.0.0
    remote:        Using arel 8.0.0
    remote:        Using execjs 2.7.0
    remote:        Using bcrypt 3.1.11
    remote:        Fetching rb-fsevent 0.10.3
    remote:        Using ffi 1.9.23
    remote:        Using will_paginate 3.1.6
    remote:        Using bundler 1.15.2
    remote:        Fetching mime-types-data 3.2016.0521
    remote:        Installing CFPropertyList 2.3.6
    remote:        Using coffee-script-source 1.12.2
    remote:        Using method_source 0.9.0
    remote:        Using thor 0.20.0
    remote:        Fetching unf_ext 0.0.7.5
    remote:        Installing rb-fsevent 0.10.3
    remote:        Installing mime-types-data 3.2016.0521
    remote:        Fetching excon 0.60.0
    remote:        Fetching formatador 0.2.5
    remote:        Installing unf_ext 0.0.7.5 with native extensions
    remote:        Installing formatador 0.2.5
    remote:        Using multi_json 1.13.1
    remote:        Fetching ipaddress 0.8.3
    remote:        Installing excon 0.60.0
    remote:        Installing ipaddress 0.8.3
    remote:        Fetching xml-simple 1.1.5
    remote:        Installing xml-simple 1.1.5
    remote:        Fetching inflecto 0.0.2
    remote:        Installing inflecto 0.0.2
    remote:        Fetching netrc 0.11.0
    remote:        Fetching json 2.1.0
    remote:        Installing netrc 0.11.0
    remote:        Installing json 2.1.0 with native extensions
    remote:        Fetching trollop 2.1.2
    remote:        Installing trollop 2.1.2
    remote:        Fetching mini_magick 4.7.0
    remote:        Installing mini_magick 4.7.0
    remote:        Fetching pg 0.20.0
    remote:        Installing pg 0.20.0 with native extensions
    remote:        Using puma 3.9.1
    remote:        Using tilt 2.0.8
    remote:        Using turbolinks-source 5.1.0
    remote:        Using i18n 0.9.5
    remote:        Using nokogiri 1.8.2
    remote:        Using tzinfo 1.2.5
    remote:        Fetching rack-test 0.8.3
    remote:        Installing rack-test 0.8.3
    remote:        Using sprockets 3.7.1
    remote:        Using mail 2.7.0
    remote:        Fetching autoprefixer-rails 8.1.0
    remote:        Installing autoprefixer-rails 8.1.0
    remote:        Using uglifier 3.2.0
    remote:        Using websocket-driver 0.6.5
    remote:        Using rb-inotify 0.9.10
    remote:        Using bootstrap-will_paginate 1.0.0
    remote:        Fetching fission 0.5.0
    remote:        Installing fission 0.5.0
    remote:        Using coffee-script 2.4.1
    remote:        Fetching mime-types 3.1
    remote:        Installing mime-types 3.1
    remote:        Fetching fog-core 1.45.0
    remote:        Installing fog-core 1.45.0
    remote:        Fetching unf 0.1.4
    remote:        Installing unf 0.1.4
    remote:        Using turbolinks 5.0.1
    remote:        Using faker 1.7.3
    remote:        Using loofah 2.2.0
    remote:        Using activesupport 5.1.4
    remote:        Using sass-listen 4.0.0
    remote:        Fetching fog-json 1.0.2
    remote:        Installing fog-json 1.0.2
    remote:        Fetching fog-xml 0.1.3
    remote:        Installing fog-xml 0.1.3
    remote:        Fetching fog-local 0.5.0
    remote:        Installing fog-local 0.5.0
    remote:        Fetching fog-vmfusion 0.1.0
    remote:        Installing fog-vmfusion 0.1.0
    remote:        Fetching domain_name 0.5.20170404
    remote:        Installing domain_name 0.5.20170404
    remote:        Using rails-html-sanitizer 1.0.3
    remote:        Using rails-dom-testing 2.0.3
    remote:        Using globalid 0.4.1
    remote:        Using activemodel 5.1.4
    remote:        Using jbuilder 2.7.0
    remote:        Using sass 3.5.5
    remote:        Fetching fog-aliyun 0.2.0
    remote:        Installing fog-aliyun 0.2.0
    remote:        Fetching fog-brightbox 0.14.0
    remote:        Installing fog-brightbox 0.14.0
    remote:        Fetching fog-dnsimple 1.0.0
    remote:        Installing fog-dnsimple 1.0.0
    remote:        Fetching fog-joyent 0.0.1
    remote:        Installing fog-joyent 0.0.1
    remote:        Fetching fog-openstack 0.1.24
    remote:        Installing fog-openstack 0.1.24
    remote:        Fetching fog-profitbricks 4.1.1
    remote:        Installing fog-profitbricks 4.1.1
    remote:        Fetching fog-sakuracloud 1.7.5
    remote:        Installing fog-sakuracloud 1.7.5
    remote:        Fetching fog-serverlove 0.1.2
    remote:        Installing fog-serverlove 0.1.2
    remote:        Fetching fog-softlayer 1.1.4
    remote:        Installing fog-softlayer 1.1.4
    remote:        Fetching fog-storm_on_demand 0.1.1
    remote:        Installing fog-storm_on_demand 0.1.1
    remote:        Fetching fog-atmos 0.1.0
    remote:        Installing fog-atmos 0.1.0
    remote:        Fetching fog-aws 2.0.1
    remote:        Installing fog-aws 2.0.1
    remote:        Fetching fog-cloudatcost 0.1.2
    remote:        Installing fog-cloudatcost 0.1.2
    remote:        Fetching fog-digitalocean 0.3.0
    remote:        Installing fog-digitalocean 0.3.0
    remote:        Fetching fog-dynect 0.0.3
    remote:        Installing fog-dynect 0.0.3
    remote:        Fetching fog-ecloud 0.3.0
    remote:        Installing fog-ecloud 0.3.0
    remote:        Fetching fog-google 0.1.0
    remote:        Installing fog-google 0.1.0
    remote:        Fetching fog-internet-archive 0.0.1
    remote:        Installing fog-internet-archive 0.0.1
    remote:        Fetching fog-powerdns 0.1.1
    remote:        Installing fog-powerdns 0.1.1
    remote:        Fetching fog-rackspace 0.1.5
    remote:        Installing fog-rackspace 0.1.5
    remote:        Fetching fog-radosgw 0.0.5
    remote:        Installing fog-radosgw 0.0.5
    remote:        Fetching fog-riakcs 0.1.0
    remote:        Installing fog-riakcs 0.1.0
    remote:        Fetching fog-terremark 0.1.0
    remote:        Installing fog-terremark 0.1.0
    remote:        Fetching fog-voxel 0.1.0
    remote:        Installing fog-voxel 0.1.0
    remote:        Fetching fog-xenserver 0.3.0
    remote:        Installing fog-xenserver 0.3.0
    remote:        Fetching http-cookie 1.0.3
    remote:        Installing http-cookie 1.0.3
    remote:        Using actionview 5.1.4
    remote:        Using activejob 5.1.4
    remote:        Using activerecord 5.1.4
    remote:        Fetching carrierwave 1.2.2
    remote:        Installing carrierwave 1.2.2
    remote:        Using bootstrap-sass 3.3.7
    remote:        Fetching rest-client 2.0.2
    remote:        Installing rest-client 2.0.2
    remote:        Using actionpack 5.1.4
    remote:        Fetching rbovirt 0.1.5
    remote:        Installing rbovirt 0.1.5
    remote:        Using actioncable 5.1.4
    remote:        Using actionmailer 5.1.4
    remote:        Using railties 5.1.4
    remote:        Using sprockets-rails 3.2.1
    remote:        Fetching fog-ovirt 0.1.3
    remote:        Installing fog-ovirt 0.1.3
    remote:        Using coffee-rails 4.2.2
    remote:        Using jquery-rails 4.3.1
    remote:        Using rails 5.1.4
    remote:        Using sass-rails 5.0.6
    remote:        Fetching rbvmomi 1.11.7
    remote:        Installing rbvmomi 1.11.7
    remote:        Fetching fog-vsphere 2.0.0
    remote:        Installing fog-vsphere 2.0.0
    remote:        Fetching fog 1.42.0
    remote:        Installing fog 1.42.0
    remote:        Bundle complete! 28 Gemfile dependencies, 117 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 fog:
    remote:        ------------------------------
    remote:        Thank you for installing fog!
    remote:        IMPORTANT NOTICE:
    remote:        If there's a metagem available for your cloud provider, e.g. `fog-aws`,
    remote:        you should be using it instead of requiring the full fog collection to avoid
    remote:        unnecessary dependencies.
    remote:        'fog' should be required explicitly only if:
    remote:        - The provider you use doesn't yet have a metagem available.
    remote:        - You require Ruby 1.9.3 support.
    remote:        ------------------------------
    remote:        Bundle completed (21.27s)
    remote:        Cleaning up the bundler cache.
    remote:        Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
    remote:        Removing autoprefixer-rails (8.0.0)
    remote:        Removing rack-test (0.8.2)
    remote:        Removing rb-fsevent (0.10.2)
    remote:        Removing pg (0.18.4)
    remote:        The latest bundler is 1.16.1, but you are currently running 1.15.2.
    remote:        To update, run `gem install bundler`
    remote: -----> Installing node-v6.11.1-linux-x64
    remote: -----> Detecting rake tasks
    remote: -----> Preparing app for Rails asset pipeline
    remote:        Running: rake assets:precompile
    remote:        rake aborted!
    remote:        ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/service.rb:244:in `validate_options'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/service.rb:268:in `handle_settings'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/service.rb:98:in `new'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/services_mixin.rb:16:in `new'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/storage.rb:27:in `new'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:124:in `eager_load_fog'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:137:in `fog_credentials='
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/config/initializers/carrier_wave.rb:3:in `block in <top (required)>'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave/uploader/configuration.rb:159:in `configure'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/carrierwave-1.2.2/lib/carrierwave.rb:14:in `configure'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/config/initializers/carrier_wave.rb:2:in `<top (required)>'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:655:in `block in load_config_initializer'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:168:in `instrument'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:654:in `load_config_initializer'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `each'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `each'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:48:in `tsort_each_child'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/config/environment.rb:5:in `<top (required)>'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
    remote:        /tmp/build_7bcb295df064a3df64ebe28634ad9302/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
    remote:        Tasks: TOP => environment
    remote:        (See full trace by running task with --trace)
    remote:  !
    remote:  !     Precompiling assets failed.
    remote:  !
    remote:  !     Push rejected, failed to compile Ruby app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy....
    remote: 
    remote: !       Push rejected to polar-hamlet-12140.
    remote: 
    To https://git.heroku.com/polar-hamlet-12140.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/polar-hamlet-12140.git'
    ec2-user:~/environment/sample_app (master) $
    
```
CC BY-SA 3.0
2018-03-07T04:05:31.200
42183
2022-04-09T08:07:00.613
2018-03-07T04:34:01.333
3060
25182
question
ruby-on-rails aws heroku
git push heroku master実行時のエラーについて
fog-coreでは、awsリソースにアクセスするための`aws_access_key_id`,
`aws_secret_access_key`が必要なのだと思われます。

<https://stackoverflow.com/questions/27949158/heroku-missing-required-
arguments-aws-access-key-id-aws-secret-access-key-f>

を参考にされたとのことですが、具体的には以下を実行されたという認識で間違いないでしょうか？

  1. heroku環境変数に`aws_access_key_id`, `aws_secret_access_key`を設定
  2. `config/initializers/carrierwave.rb`を修正し、fog-awsから設定された環境変数の`aws_access_key_id`, `aws_secret_access_key`を読み込むようにする
CC BY-SA 4.0
2019-01-05T04:32:07.477
51716
2019-01-05T04:32:07.477
31669
42183
answer