簡體   English   中英

<activesupport::messageencryptor::invalidmessage: activesupport::messageencryptor::invalidmessage error when deploying to heroku rails 5.2.3< div><div id="text_translate"><p> 我在將我的 React on Rails 應用程序部署到 Heroku 時遇到了很多麻煩。 我已經閱讀並嘗試了無數關於如何解決 secret_key_base 和 rails_master_key 問題的帖子:</p><p> <a href="https://stackoverflow.com/questions/54277392/activesupportmessageencryptorinvalidmessage" rel="nofollow noreferrer">ActiveSupport::MessageEncryptor::InvalidMessage</a></p><p> <a href="https://stackoverflow.com/questions/50102639/running-a-rails-server-in-production-locally-invalidmessage-error" rel="nofollow noreferrer">在本地運行 Rails 服務器(InvalidMessage 錯誤)</a></p><p> 對這些都沒有任何運氣,並且似乎對用於解決這些問題的許多實踐進行了很好的辯論(從我讀過的答案來看)。</p><p> 這是我在 Heroku 日志中遇到的錯誤:</p><pre> 2019-10-23T15:27:31.187947+00:00 app[web.1]: 2019-10-23 15:27:31 +0000: Rack app error handling request { GET / } 2019-10-23T15:27:31.18796+00:00 app[web.1]: #&lt;ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage&gt; 2019-10-23T15:27:31.187962+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt' 2019-10-23T15:27:31.187964+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:184:in `_decrypt' 2019-10-23T15:27:31.187966+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify' 2019-10-23T15:27:31.187968+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify' 2019-10-23T15:27:31.187971+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:44:in `decrypt' 2019-10-23T15:27:31.187973+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:81:in `preprocess' 2019-10-23T15:27:31.187975+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:29:in `block in parse' 2019-10-23T15:27:31.187977+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each' 2019-10-23T15:27:31.187979+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each_with_object' 2019-10-23T15:27:31.187981+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `parse' 2019-10-23T15:27:31.187983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:399:in `secrets' 2019-10-23T15:27:31.187985+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:252:in `env_config' 2019-10-23T15:27:31.187987+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:706:in `build_request' 2019-10-23T15:27:31.18799+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:608:in `build_request' 2019-10-23T15:27:31.187992+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:523:in `call' 2019-10-23T15:27:31.187994+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call' 2019-10-23T15:27:31.187996+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request' 2019-10-23T15:27:31.187997+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client' 2019-10-23T15:27:31.187999+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run' 2019-10-23T15:27:31.188001+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread' 2019-10-23T15:27:31.447079+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=glacial-woodland-16769.herokuapp.com request_id=922c9b94-3b2b-43fd-9cec-b5eb2d78e21f fwd="8.20.20.246" dyno=web.1 connect=1ms service=16ms status=500 bytes=154 protocol=https 2019-10-23T15:27:31.445658+00:00 app[web.1]: 2019-10-23 15:27:31 +0000: Rack app error handling request { GET /favicon.ico } 2019-10-23T15:27:31.445671+00:00 app[web.1]: #&lt;ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage&gt; 2019-10-23T15:27:31.445673+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt' 2019-10-23T15:27:31.445675+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:184:in `_decrypt' 2019-10-23T15:27:31.445677+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify' 2019-10-23T15:27:31.445679+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify' 2019-10-23T15:27:31.445681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:44:in `decrypt' 2019-10-23T15:27:31.445683+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:81:in `preprocess' 2019-10-23T15:27:31.445685+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:29:in `block in parse' 2019-10-23T15:27:31.445687+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each' 2019-10-23T15:27:31.445688+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each_with_object' 2019-10-23T15:27:31.44569+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `parse' 2019-10-23T15:27:31.445693+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:399:in `secrets' 2019-10-23T15:27:31.445695+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:252:in `env_config' 2019-10-23T15:27:31.445697+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:706:in `build_request' 2019-10-23T15:27:31.445699+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:608:in `build_request' 2019-10-23T15:27:31.445701+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:523:in `call' 2019-10-23T15:27:31.445703+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call' 2019-10-23T15:27:31.445705+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request' 2019-10-23T15:27:31.445707+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client' 2019-10-23T15:27:31.445709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run' 2019-10-23T15:27:31.446389+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'</pre><p> 將不勝感激任何幫助,並可以提供我可能遺漏的任何細節。 我對 Heroku 比較陌生,所以我可能只是忽略了一些明顯的事情,如果是這種情況,我深表歉意!</p></div></activesupport::messageencryptor::invalidmessage:>

[英]<ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage Error when deploying to Heroku Rails 5.2.3

我在將我的 React on Rails 應用程序部署到 Heroku 時遇到了很多麻煩。 我已經閱讀並嘗試了無數關於如何解決 secret_key_base 和 rails_master_key 問題的帖子:

ActiveSupport::MessageEncryptor::InvalidMessage

在本地運行 Rails 服務器(InvalidMessage 錯誤)

對這些都沒有任何運氣,並且似乎對用於解決這些問題的許多實踐進行了很好的辯論(從我讀過的答案來看)。

這是我在 Heroku 日志中遇到的錯誤:

2019-10-23T15:27:31.187947+00:00 app[web.1]: 2019-10-23 15:27:31 +0000: Rack app error handling request { GET / }
2019-10-23T15:27:31.18796+00:00 app[web.1]: #<ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage>
2019-10-23T15:27:31.187962+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
2019-10-23T15:27:31.187964+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:184:in `_decrypt'
2019-10-23T15:27:31.187966+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
2019-10-23T15:27:31.187968+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
2019-10-23T15:27:31.187971+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:44:in `decrypt'
2019-10-23T15:27:31.187973+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:81:in `preprocess'
2019-10-23T15:27:31.187975+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:29:in `block in parse'
2019-10-23T15:27:31.187977+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each'
2019-10-23T15:27:31.187979+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each_with_object'
2019-10-23T15:27:31.187981+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `parse'
2019-10-23T15:27:31.187983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:399:in `secrets'
2019-10-23T15:27:31.187985+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:252:in `env_config'
2019-10-23T15:27:31.187987+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:706:in `build_request'
2019-10-23T15:27:31.18799+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:608:in `build_request'
2019-10-23T15:27:31.187992+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:523:in `call'
2019-10-23T15:27:31.187994+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call'
2019-10-23T15:27:31.187996+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request'
2019-10-23T15:27:31.187997+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client'
2019-10-23T15:27:31.187999+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'
2019-10-23T15:27:31.188001+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'
2019-10-23T15:27:31.447079+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=glacial-woodland-16769.herokuapp.com request_id=922c9b94-3b2b-43fd-9cec-b5eb2d78e21f fwd="8.20.20.246" dyno=web.1 connect=1ms service=16ms status=500 bytes=154 protocol=https
2019-10-23T15:27:31.445658+00:00 app[web.1]: 2019-10-23 15:27:31 +0000: Rack app error handling request { GET /favicon.ico }
2019-10-23T15:27:31.445671+00:00 app[web.1]: #<ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage>
2019-10-23T15:27:31.445673+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
2019-10-23T15:27:31.445675+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:184:in `_decrypt'
2019-10-23T15:27:31.445677+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
2019-10-23T15:27:31.445679+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
2019-10-23T15:27:31.445681+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:44:in `decrypt'
2019-10-23T15:27:31.445683+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:81:in `preprocess'
2019-10-23T15:27:31.445685+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:29:in `block in parse'
2019-10-23T15:27:31.445687+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each'
2019-10-23T15:27:31.445688+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `each_with_object'
2019-10-23T15:27:31.44569+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/secrets.rb:26:in `parse'
2019-10-23T15:27:31.445693+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:399:in `secrets'
2019-10-23T15:27:31.445695+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:252:in `env_config'
2019-10-23T15:27:31.445697+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:706:in `build_request'
2019-10-23T15:27:31.445699+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/application.rb:608:in `build_request'
2019-10-23T15:27:31.445701+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/engine.rb:523:in `call'
2019-10-23T15:27:31.445703+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call'
2019-10-23T15:27:31.445705+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request'
2019-10-23T15:27:31.445707+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client'
2019-10-23T15:27:31.445709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'
2019-10-23T15:27:31.446389+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'

將不勝感激任何幫助,並可以提供我可能遺漏的任何細節。 我對 Heroku 比較陌生,所以我可能只是忽略了一些明顯的事情,如果是這種情況,我深表歉意!

就我而言,我們有一個多環境憑據設置。

一種用於開發、登台和生產。

master.key 適用於主要

 credentials.yml file

其他環境有自己的密鑰,所以我們在 staging.key 中使用了staging.key

heroku 上的 RAILS_MASTER_KEY。

對於正常使用,請嘗試以下操作:

從credentails.yml 文件中復制數據刪除credentials.yml 和master.key

使用Editor='code --wait' rails credentails:edit relplace code 和您的編輯器名稱。

將credentails 數據粘貼到credentails 文件中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM