I was working on deploying the Live Beats app from the Fly repo and kept running into an issue when trying to export GitHub client ID and secret. When doing this:
export LIVE_BEATS_GITHUB_CLIENT_ID=“…”
export LIVE_BEATS_GITHUB_CLIENT_SECRET=“…”
I kept getting an error that the LIVE_BEATS_GITHUB_CLIENT_ID
or LIVE_BEATS_GITHUB_CLIENT_SECRET
wasn’t set. It was almost as if the terminal or fly launch
wasn’t catching the envs being exported. It only seemed to go through and work when using flyctl secrets set
. I shouldn’t have to use flyctl secrets set
in this case, right? It should work with me exporting the envs?
Here is the full error that I was getting in the terminal-
ERROR! Config provider Config.Reader failed with:
** (ArgumentError) could not fetch environment variable “LIVE_BEATS_GITHUB_CLIENT_ID” because it is not set
(elixir 1.12.0) lib/system.ex:699: System.fetch_env!/1
(stdlib 3.15) erl_eval.erl:685: :erl_eval.do_apply/6
(stdlib 3.15) erl_eval.erl:893: :erl_eval.expr_list/6
(stdlib 3.15) erl_eval.erl:237: :erl_eval.expr/5
(stdlib 3.15) erl_eval.erl:229: :erl_eval.expr/5
(stdlib 3.15) erl_eval.erl:893: :erl_eval.expr_list/6
(stdlib 3.15) erl_eval.erl:408: :erl_eval.expr/5
(stdlib 3.15) erl_eval.erl:123: :erl_eval.exprs/5
{“init terminating in do_boot”,{#{‘exception’=>true,‘struct’=>‘Elixir.ArgumentError’,message=><<“could not fetch environment variable "LIVE_BEATS_GITHUB_CLIENT_ID" because it is not set”>>},[{‘Elixir.System’,‘fetch_env!’,1,[{file,“lib/system.ex”},{line,699}]},{erl_eval,do_apply,6,[{file,“erl_eval.erl”},{line,685}]},{erl_eval,expr_list,6,[{file,“erl_eval.erl”},{line,893}]},{erl_eval,expr,5,[{file,“erl_eval.erl”},{line,237}]},{erl_eval,expr,5,[{file,“erl_eval.erl”},{line,229}]},{erl_eval,expr_list,6,[{file,“erl_eval.erl”},{line,893}]},{erl_eval,expr,5,[{file,“erl_eval.erl”},{line,408}]},{erl_eval,exprs,5,[{file,“erl_eval.erl”},{line,123}]}]}}
init terminating in do_boot ({,[{Elixir.System,fetch_env!,1,[{},{}]},{erl_eval,do_apply,6,[{},{}]},{erl_eval,expr_list,6,[{},{}]},{erl_eval,expr,5,[{},{}]},{erl_eval,expr,5,[{},{}]},{erl_eva
Crash dump is being written to: erl_crash.dump…done
2023-06-12T23:21:43.713618Z INFO libinit::linux::proc: Main child exited normally with code: 1
2023-06-12T23:21:43.714514Z INFO init: Starting clean up.
2023-06-12T23:21:43.715197Z WARN init::hallpass: hallpass exited, pid: 526, status: signal: 15 (SIGTERM)
2023/06/12 23:21:43 listening on [fdaa:2:4e3a:a7b:137:d53:899a:2]:22 (DNS: [fdaa::3]:53)
[ 2.150832] reboot: Restarting system
machine restart policy set to ‘no’, not restarting
Error: release command failed - aborting deployment. error release_command machine 3d8d945ec196d8 exited with non-zero status of 1