Ошибка Heroku: «ключ должен быть 16 байтов», но ключ, который я ввел, составляет 16 байтов - PullRequest
0 голосов
/ 26 апреля 2019

Я запускаю Heroku впервые и получаю сообщение об ошибке «ArgumentError: ключ должен быть 16 байтов».

Я запустил rails credentials:edit для генерации нового ключа, получил ключ длиной 32 символа, heroku config:set RAILS_MASTER_KEY='<master key>' и он был принят. Но я все еще получаю ошибку, когда я запускаю его.

Я не уверен, что делаю неправильно.

Вот полное сообщение об ошибке:

Running: rake assets:precompile
       rake aborted!
       ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:183:in `_decrypt'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:79:in `decrypt'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:42:in `read'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:21:in `read'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:33:in `config'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:38:in `options'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/secret_key_finder.rb:24:in `key_exists?'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/secret_key_finder.rb:10:in `find'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/rails.rb:37:in `block in <class:Engine>'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
       /tmp/build_e151bdf198daf12c42102939c20b0959/config/environment.rb:7:in `<top (required)>'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'

       Caused by:
       ArgumentError: key must be 16 bytes
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:193:in `key='
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:193:in `_decrypt'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:79:in `decrypt'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb:42:in `read'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:21:in `read'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:33:in `config'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb:38:in `options'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/secret_key_finder.rb:24:in `key_exists?'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/secret_key_finder.rb:10:in `find'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/devise-4.6.2/lib/devise/rails.rb:37:in `block in <class:Engine>'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
       /tmp/build_e151bdf198daf12c42102939c20b0959/config/environment.rb:7:in `<top (required)>'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
       /tmp/build_e151bdf198daf12c42102939c20b0959/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
       Tasks: TOP => environment
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

1 Ответ

0 голосов
/ 26 апреля 2019

Изначально в команде набора конфигурации главного ключа были кавычки, например: '<master key>', которую Heroku интерпретирует как часть главного ключа.

Просто для потомков, я собираюсь оставить правильно отформатированную команду, которую мы выяснили в комментариях:

$ heroku config:set RAILS_MASTER_KEY=<master key>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...