JSON 文件在 运行 一个版本的二进制文件时找不到,但在 运行 `iex -S mix phx.server` 时找到

JSON file cannot be found when running a release's binary, but it is found when running with `iex -S mix phx.server`

当运行以下时,一切正常:

GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to.json \
MIX_ENV=prod \
DATABASE_URL=... \
SECRET_KEY_BASE=... \
HOST=localhost \
PORT=80 \
iex -S mix phx.server

但是,当使用 mix release 生成 Elixir 版本时:

GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to.json \
MIX_ENV=prod \
DATABASE_URL=... \
SECRET_KEY_BASE=... \
HOST=localhost \
PORT=80 \
mix release

iex -S mix phx.server替换为mix release,其余相同)

和运行它通过:_build/prod/rel/app/bin/app start

我收到以下错误:

0:24:29.781 [info] Application goth exited: Goth.start(:normal, []) returned an error: shutdown: failed to start child: Goth.Config
    ** (EXIT) an exception was raised:
        ** (RuntimeError)  Failed to retrieve project data from GCE internal metadata service.
                   Either you haven't configured your GCP credentials, you aren't running on GCE, or both.
                   Please see README.md for instructions on configuring your credentials.
            (goth 1.2.0) lib/goth/config.ex:182: Goth.Config.determine_project_id/2
            (goth 1.2.0) lib/goth/config.ex:73: anonymous fn/2 in Goth.Config.load_and_init/1
            (elixir 1.11.2) lib/enum.ex:1403: anonymous fn/3 in Enum.map/2
            (stdlib 3.13.2) maps.erl:233: :maps.fold_1/3
            (elixir 1.11.2) lib/enum.ex:2197: Enum.map/2
            (goth 1.2.0) lib/goth/config.ex:71: Goth.Config.load_and_init/1
            (stdlib 3.13.2) gen_server.erl:417: :gen_server.init_it/2
            (stdlib 3.13.2) gen_server.erl:385: :gen_server.init_it/6

这个错误意味着 GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to.json 部分没有按预期工作。由于某种原因,无法找到 JSON 文件。

我可以保证 JSON 文件存在,而且它似乎无法从发行版中访问。

有谁知道为什么 运行 发布的应用程序找不到 JSON 文件?

版本的运行时配置是通过 config/runtime.exsconfig/releases.exsv1.11 之前)完成的,并在文档 here.

中进行了讨论