【发布时间】:2018-06-21 08:18:48
【问题描述】:
我已将我的 Ruby on Rails 应用程序从 Rails 5.1.2 迁移到 Rails 5.2.0 以使用加密的机密。应用程序已成功部署到 Digital Ocean Ubuntu Server。但是当我进入浏览器访问时,它会显示以下日志。
ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:206:in `rescue in _decrypt'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:184:in `_decrypt'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/message_encryptor.rb:157:in `decrypt_and_verify'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/messages/rotator.rb:21:in `decrypt_and_verify'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:79:in `decrypt'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_file.rb:42:in `read'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:21:in `read'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:33:in `config'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/encrypted_configuration.rb:38:in `options'
/home/deploy/apps/GeekyCricket/shared/bundle/ruby/2.4.0/gems/activesupport-5.2.0/lib/active_support/core_ext/module/delegation.rb:271:in `method_missing'
(erb):12:in `<main>'
我使用rails credentials:edit 添加了加密的秘密,它创建了config/credentials.yml.enc 和master.key。
我还在我的 ubuntu 服务器上的 /app_name/shared/config/ 上添加了 master.key 文件,还放置了一个环境变量 RAILS_MASTER_KEY。但是仍然出现此错误,我不知道我在这里缺少什么。
【问题讨论】:
-
如果它解决了你的问题,你能不能让答案是正确的答案,@talha-junaid?否则,我愿意帮助你。
-
你解决了吗?我真的很想帮你。
-
你解决了吗?我真的很想帮你。谢谢
-
谢谢@Boris,我解决了