ノンカフェインであなたにやさしい

Ruby,Rails,HTML,CSS,Reactなど

Rails ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage

新規のアプリデプロイ時にこんなエラーが

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:203:in `rescue in _decrypt'
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:180:in `_decrypt'
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:154:in `decrypt_and_verify'
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/messages/rotator.rb:22:in `decrypt_and_verify'
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/encrypted_file.rb:92:in `decrypt'
       /tmp/build_120aa013/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/encrypted_file.rb:54:in `read'

マスターキーが正しくないことが原因のよう確認して環境変数 RAILS_MASTER_KEY に入れ直して解消

cat config/master.key