首页 > 解决方案 > 生产环境的 Heroku 错误 `secret_key_base` 必须是 String 类型

问题描述

当我放 $git push heroku master 时,我得到一个参数错误:

远程:-----> 为 Rails 资产管道远程准备应用程序:运行:rake 资产:预编译远程:ArgumentError:secret_key_base生产环境必须是字符串类型 remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:583:invalidate_secret_key_base' 远程:/tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/ 2.5.0/gems/railties-5.2.2/lib/rails/application.rb:432:in secret_key_base' remote: /tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:176:inkey_generator' 远程:/tmp/build_19076210a01025325310b08d032af424/vendor/bundle/ruby/2.5.0/gems/railties-5.2.2/ lib/rails/application.rb:205:in `message_verifier' .....................

我的 Rails 版本是 5.2,在 config/credentials.yml.enc 中有新的加密系统。我猜这个配置会导致这个heroku错误。

没有人有这个问题并描述如何解决这个错误。

你能帮我解决这个错误吗?谢谢。

标签: ruby-on-railsherokucredentials

解决方案


https://waiyanyoon.com/deploying-rails-5-2-applications-with-encrypted-credentials-using-capistrano/

在推送到 heroku 之前,尝试在本地以 PRODUCTION 模式编译资产,看看是否一切正常。


推荐阅读