小编Jer*_*rry的帖子

cookie 存储期望 conn.secret_key_base 至少为 64 字节 - 但它已经

在生产中我有这个:

use Mix.Config

config :my_app, MyApp.Endpoint,
  secret_key_base: System.get_env("MYAPP_SECRET_KEY_BASE")
Run Code Online (Sandbox Code Playgroud)

该值在 /etc/environment 中设置并且足够长,我是从“mix phoenix.gen.secret”创建的。然而,它仍然抛出一个错误:

** (exit) an exception was raised:
        ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes
            (plug) lib/plug/session/cookie.ex:159: Plug.Session.COOKIE.validate_secret_key_base/1
            (plug) lib/plug/session/cookie.ex:152: Plug.Session.COOKIE.derive/3
            (plug) lib/plug/session/cookie.ex:103: Plug.Session.COOKIE.put/4
            (plug) lib/plug/session.ex:92: anonymous fn/3 in Plug.Session.before_send/2
            (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
            (plug) lib/plug/conn.ex:961: Plug.Conn.run_before_send/2
            (plug) lib/plug/conn.ex:392: Plug.Conn.send_resp/1
            (my_app) web/controllers/home_controller.ex:1: MyApp.HomeController.action/2
Run Code Online (Sandbox Code Playgroud)

elixir phoenix-framework

6
推荐指数
1
解决办法
2568
查看次数

标签 统计

elixir ×1

phoenix-framework ×1