ruby-on-rails - 生产环境的 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:in
validate_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:in
key_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错误。
没有人有这个问题并描述如何解决这个错误。
你能帮我解决这个错误吗?谢谢。
解决方案
https://waiyanyoon.com/deploying-rails-5-2-applications-with-encrypted-credentials-using-capistrano/
在推送到 heroku 之前,尝试在本地以 PRODUCTION 模式编译资产,看看是否一切正常。
推荐阅读
- c# - Unity 2019.3.0a7:Microsoft Visual C# 编译器错误
- javascript - 如何导出异步加载的数据以在不同的节点模块中使用?
- ios - UIImagePickerController Apple TV 屏幕镜像问题
- python - 如何使用 Python 操作音符?
- javascript - Chart Js 不更新第一次加载中的值
- android - 在没有 Dagger2 循环依赖的情况下,如何在 AuthenticationInterceptor 的身份验证方法中触发同步刷新令牌调用?
- html - 如何将图像向左对齐,标题和 p 向右对齐
- xml - 在powershell中比较同一父节点的两个xml元素
- python - 您如何在蓝图中引用 Flask 应用程序工厂的其他模块?
- c# - “Freezer.Utils.ZipDeployer”的类型初始化程序引发异常