Can't fetch value for key `BorsNG.GitHub.Server` of application `:bors

Can't really figure out the issue here.

Logs:

State changed from crashed to starting
2021-09-06T01:31:47.912056+00:00 heroku[web.1]: Starting process with command `mix phx.server`
2021-09-06T01:31:51.650247+00:00 app[web.1]: 01:31:51.620 pid=<0.369.0> [error] GenServer BorsNG.GitHub terminating
2021-09-06T01:31:51.650272+00:00 app[web.1]: ** (ArgumentError) can't fetch value for key `BorsNG.GitHub.Server` of application `:bors`, expected `Elixir.Base.decode64/1` to return either `{:ok, value}` or `{:error, reason}` tuple, got: `:error`
2021-09-06T01:31:51.650273+00:00 app[web.1]: (confex 3.5.0) lib/confex.ex:155: Confex.fetch_env!/2
2021-09-06T01:31:51.650273+00:00 app[web.1]: (bors 0.1.0) lib/github/github/server.ex:864: BorsNG.GitHub.Server.get_jwt_token/0
2021-09-06T01:31:51.650274+00:00 app[web.1]: (bors 0.1.0) lib/github/github/server.ex:63: BorsNG.GitHub.Server.handle_call/3
2021-09-06T01:31:51.650274+00:00 app[web.1]: (stdlib 3.15) gen_server.erl:721: :gen_server.try_handle_call/4
2021-09-06T01:31:51.650274+00:00 app[web.1]: (stdlib 3.15) gen_server.erl:750: :gen_server.handle_msg/6
2021-09-06T01:31:51.650275+00:00 app[web.1]: (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
2021-09-06T01:31:51.650275+00:00 app[web.1]: Last message (from BorsNG.Supervisor): :get_app
2021-09-06T01:31:51.655764+00:00 app[web.1]: 01:31:51.650 pid=<0.44.0> [info] Application bors exited: BorsNG.Application.start(:normal, []) returned an error: shutdown: failed to start child: BorsNG.Attrs
2021-09-06T01:31:51.655765+00:00 app[web.1]: ** (EXIT) exited in: GenServer.call(BorsNG.GitHub, :get_app, 10000)
2021-09-06T01:31:51.655766+00:00 app[web.1]: ** (EXIT) an exception was raised:
2021-09-06T01:31:51.655767+00:00 app[web.1]: ** (ArgumentError) can't fetch value for key `BorsNG.GitHub.Server` of application `:bors`, expected `Elixir.Base.decode64/1` to return either `{:ok, value}` or `{:error, reason}` tuple, got: `:error`
2021-09-06T01:31:51.655767+00:00 app[web.1]: (confex 3.5.0) lib/confex.ex:155: Confex.fetch_env!/2
2021-09-06T01:31:51.655768+00:00 app[web.1]: (bors 0.1.0) lib/github/github/server.ex:864: BorsNG.GitHub.Server.get_jwt_token/0
2021-09-06T01:31:51.655768+00:00 app[web.1]: (bors 0.1.0) lib/github/github/server.ex:63: BorsNG.GitHub.Server.handle_call/3
2021-09-06T01:31:51.655768+00:00 app[web.1]: (stdlib 3.15) gen_server.erl:721: :gen_server.try_handle_call/4
2021-09-06T01:31:51.655769+00:00 app[web.1]: (stdlib 3.15) gen_server.erl:750: :gen_server.handle_msg/6
2021-09-06T01:31:51.655769+00:00 app[web.1]: (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
2021-09-06T01:31:53.183131+00:00 app[web.1]: {"Kernel pid terminated",application_controller,"{application_start_failure,bors,{{shutdown,{failed_to_start_child,'Elixir.BorsNG.Attrs',{'EXIT',{{#{'__exception__' => true,'__struct__' => 'Elixir.ArgumentError',message => <<\"can't fetch value for key `BorsNG.GitHub.Server` of application `:bors`, expected `Elixir.Base.decode64/1` to return either `{:ok, value}` or `{:error, reason}` tuple, got: `:error`\">>},[{'Elixir.Confex','fetch_env!',2,[{file,\"lib/confex.ex\"},{line,155}]},{'Elixir.BorsNG.GitHub.Server',get_jwt_token,0,[{file,\"lib/github/github/server.ex\"},{line,864}]},{'Elixir.BorsNG.GitHub.Server',handle_call,3,[{file,\"lib/github/github/server.ex\"},{line,63}]},{gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,721}]},{gen_server,handle_msg,6,[{file,\"gen_server.erl\"},{line,750}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,226}]}]},{'Elixir.GenServer',call,['Elixir.BorsNG.GitHub',get_app,10000]}}}}},{'Elixir.BorsNG.Application',start,[normal,[]]}}}"}
2021-09-06T01:31:53.183603+00:00 app[web.1]: Kernel pid terminated (application_controller) ({application_start_failure,bors,{{shutdown,{failed_to_start_child,'Elixir.BorsNG.Attrs',{'EXIT',{{#{'__exception__' => true,'__struct__' => 'Elixir.Argu
2021-09-06T01:31:53.183848+00:00 app[web.1]: 
2021-09-06T01:31:53.311011+00:00 app[web.1]: Crash dump is being written to: erl_crash.dump...done
2021-09-06T01:31:53.356867+00:00 heroku[web.1]: Process exited with status 1
2021-09-06T01:31:53.503679+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-06T01:32:10.571521+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/webhook/github" host=borsts.herokuapp.com request_id=470a35f2-bba2-46bc-ac08-9691fb71cc6e fwd="140.82.115.246" dyno= connect= service= status=503 bytes= protocol=https

Any help is appreciated.

Thanks

It’s complaining about base64, so there’s probably a mistake in your GITHUB_INTEGRATION_PEM.

You need to take the file that GitHub gave you, and base64 encode it. Make sure you include the = signs on the end.

@notriddle thanks for reply. I did it using openssl base64 -in <infile> -out <outfile>.
After encoding it looks something like this:

LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVB
... missing text
... missing test
b2Y4Z1FCVGFNMUJGCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

Still the same issue.

You also need to get rid of the line wrapping, with -w0

Edit: Nevermind, I was using a personal access token as a GITHUB_CLIENT_SECRET!.
Generated a new Client Secret for the app. Works like a charm

Thanks a lot.

It works now. Thanks for the help.


It's -A option on mac.

Now I get some Bad credentials error. What scopes should I select when creating a personal access token?

2021-09-06T17:25:35.438733+00:00 heroku[web.1]: Starting process with command `mix phx.server`
2021-09-06T17:25:39.589814+00:00 app[web.1]: 17:25:39.534 pid=<0.363.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589830+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589831+00:00 app[web.1]: 
2021-09-06T17:25:39.589925+00:00 app[web.1]: 17:25:39.531 pid=<0.353.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589926+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589926+00:00 app[web.1]: 
2021-09-06T17:25:39.589927+00:00 app[web.1]: 17:25:39.531 pid=<0.368.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589927+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589927+00:00 app[web.1]: 
2021-09-06T17:25:39.589928+00:00 app[web.1]: 17:25:39.534 pid=<0.356.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589928+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589929+00:00 app[web.1]: 
2021-09-06T17:25:39.589929+00:00 app[web.1]: 17:25:39.531 pid=<0.351.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589929+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589929+00:00 app[web.1]: 
2021-09-06T17:25:39.589930+00:00 app[web.1]: 17:25:39.534 pid=<0.355.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589930+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589930+00:00 app[web.1]: 
2021-09-06T17:25:39.589930+00:00 app[web.1]: 17:25:39.534 pid=<0.361.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589931+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589931+00:00 app[web.1]: 
2021-09-06T17:25:39.589932+00:00 app[web.1]: 17:25:39.534 pid=<0.364.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589932+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589932+00:00 app[web.1]: 
2021-09-06T17:25:39.589932+00:00 app[web.1]: 17:25:39.535 pid=<0.357.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589932+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589933+00:00 app[web.1]: 
2021-09-06T17:25:39.589933+00:00 app[web.1]: 17:25:39.534 pid=<0.358.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589933+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589933+00:00 app[web.1]: 
2021-09-06T17:25:39.589933+00:00 app[web.1]: 17:25:39.535 pid=<0.366.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589934+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589934+00:00 app[web.1]: 
2021-09-06T17:25:39.589934+00:00 app[web.1]: 17:25:39.535 pid=<0.359.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589934+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589934+00:00 app[web.1]: 
2021-09-06T17:25:39.589935+00:00 app[web.1]: 17:25:39.535 pid=<0.354.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589935+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589935+00:00 app[web.1]: 
2021-09-06T17:25:39.589935+00:00 app[web.1]: 17:25:39.534 pid=<0.352.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589935+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589936+00:00 app[web.1]: 
2021-09-06T17:25:39.589936+00:00 app[web.1]: 17:25:39.534 pid=<0.367.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589936+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589936+00:00 app[web.1]: 
2021-09-06T17:25:39.589936+00:00 app[web.1]: 17:25:39.535 pid=<0.362.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589937+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589937+00:00 app[web.1]: 
2021-09-06T17:25:39.589937+00:00 app[web.1]: 17:25:39.534 pid=<0.365.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589937+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589938+00:00 app[web.1]: 
2021-09-06T17:25:39.589938+00:00 app[web.1]: 17:25:39.534 pid=<0.360.0> [warn] Description: 'Authenticity is not established by certificate path validation'
2021-09-06T17:25:39.589938+00:00 app[web.1]: Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'
2021-09-06T17:25:39.589938+00:00 app[web.1]: 
2021-09-06T17:25:40.292033+00:00 heroku[web.1]: State changed from starting to up
2021-09-06T17:25:40.068896+00:00 app[web.1]: 17:25:40.068 pid=<0.425.0> [warn] The :pubsub key in your BorsNG.Endpoint is deprecated.
2021-09-06T17:25:40.068898+00:00 app[web.1]: 
2021-09-06T17:25:40.068898+00:00 app[web.1]: You must now start the pubsub in your application supervision tree.
2021-09-06T17:25:40.068899+00:00 app[web.1]: Go to lib/my_app/application.ex and add the following:
2021-09-06T17:25:40.068899+00:00 app[web.1]: 
2021-09-06T17:25:40.068900+00:00 app[web.1]: {Phoenix.PubSub, [name: BorsNG.PubSub, adapter: Phoenix.PubSub.PG2]}
2021-09-06T17:25:40.068900+00:00 app[web.1]: 
2021-09-06T17:25:40.068900+00:00 app[web.1]: Now, back in your config files in config/*, you can remove the :pubsub
2021-09-06T17:25:40.068901+00:00 app[web.1]: key and add the :pubsub_server key, with the PubSub name:
2021-09-06T17:25:40.068901+00:00 app[web.1]: 
2021-09-06T17:25:40.068901+00:00 app[web.1]: pubsub_server: BorsNG.PubSub
2021-09-06T17:25:40.068902+00:00 app[web.1]: 
2021-09-06T17:25:40.074049+00:00 app[web.1]: 17:25:40.073 pid=<0.425.0> [warn] Phoenix.Endpoint.CowboyAdapter is deprecated and it will be removed in next versions. Please make sure {:plug_cowboy, "~> 2.1"} or later is listed in your mix.exs
2021-09-06T17:25:40.113247+00:00 app[web.1]: 17:25:40.112 pid=<0.347.0> [info] Access BorsNG.Endpoint at https://borsts.herokuapp.com
2021-09-06T17:25:50.631724+00:00 app[web.1]: 17:25:50.631 request_id=3159a7ac-c191-4db1-9b64-eca84350579d pid=<0.546.0> [info] GET /auth/github/callback
2021-09-06T17:25:51.055613+00:00 heroku[router]: at=info method=GET path="/auth/github/callback?code=b9055780a1b12dde04b8" host=borsts.herokuapp.com request_id=3159a7ac-c191-4db1-9b64-eca84350579d fwd="213.238.192.194" dyno=web.1 connect=0ms service=446ms status=500 bytes=538 protocol=https
2021-09-06T17:25:51.056173+00:00 app[web.1]: 17:25:51.056 request_id=3159a7ac-c191-4db1-9b64-eca84350579d pid=<0.546.0> [info] Sent 500 in 424ms
2021-09-06T17:25:51.061370+00:00 app[web.1]: 17:25:51.056 pid=<0.442.0> [error] #PID<0.546.0> running BorsNG.Endpoint (cowboy_protocol) terminated
2021-09-06T17:25:51.061371+00:00 app[web.1]: Server: borsts.herokuapp.com:80 (http)
2021-09-06T17:25:51.061372+00:00 app[web.1]: Request: GET /auth/github/callback?code=b9055780a1b12dde04b8
2021-09-06T17:25:51.061372+00:00 app[web.1]: ** (exit) an exception was raised:
2021-09-06T17:25:51.061373+00:00 app[web.1]: ** (OAuth2.Error) Server responded with status: 401
2021-09-06T17:25:51.061373+00:00 app[web.1]: 
2021-09-06T17:25:51.061374+00:00 app[web.1]: Headers:
2021-09-06T17:25:51.061374+00:00 app[web.1]: 
2021-09-06T17:25:51.061375+00:00 app[web.1]: server: GitHub.com
2021-09-06T17:25:51.061375+00:00 app[web.1]: date: Mon, 06 Sep 2021 17:25:50 GMT
2021-09-06T17:25:51.061376+00:00 app[web.1]: content-type: application/json; charset=utf-8
2021-09-06T17:25:51.061376+00:00 app[web.1]: content-length: 80
2021-09-06T17:25:51.061376+00:00 app[web.1]: x-github-media-type: github.v3
2021-09-06T17:25:51.061376+00:00 app[web.1]: x-ratelimit-limit: 60
2021-09-06T17:25:51.061376+00:00 app[web.1]: x-ratelimit-remaining: 59
2021-09-06T17:25:51.061377+00:00 app[web.1]: x-ratelimit-reset: 1630952750
2021-09-06T17:25:51.061377+00:00 app[web.1]: x-ratelimit-used: 1
2021-09-06T17:25:51.061377+00:00 app[web.1]: x-ratelimit-resource: core
2021-09-06T17:25:51.061378+00:00 app[web.1]: access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
2021-09-06T17:25:51.061379+00:00 app[web.1]: access-control-allow-origin: *
2021-09-06T17:25:51.061379+00:00 app[web.1]: strict-transport-security: max-age=31536000; includeSubdomains; preload
2021-09-06T17:25:51.061379+00:00 app[web.1]: x-frame-options: deny
2021-09-06T17:25:51.061380+00:00 app[web.1]: x-content-type-options: nosniff
2021-09-06T17:25:51.061380+00:00 app[web.1]: x-xss-protection: 0
2021-09-06T17:25:51.061380+00:00 app[web.1]: referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
2021-09-06T17:25:51.061380+00:00 app[web.1]: content-security-policy: default-src 'none'
2021-09-06T17:25:51.061381+00:00 app[web.1]: vary: Accept-Encoding, Accept, X-Requested-With
2021-09-06T17:25:51.061381+00:00 app[web.1]: x-github-request-id: 9448:4EEC:C33B8:C794B:61364F1E
2021-09-06T17:25:51.061381+00:00 app[web.1]: 
2021-09-06T17:25:51.061382+00:00 app[web.1]: Body:
2021-09-06T17:25:51.061382+00:00 app[web.1]: 
2021-09-06T17:25:51.061382+00:00 app[web.1]: %{"documentation_url" => "https://docs.github.com/rest", "message" => "Bad credentials"}
2021-09-06T17:25:51.061383+00:00 app[web.1]: 
2021-09-06T17:25:51.061383+00:00 app[web.1]: (oauth2 2.0.0) lib/oauth2/request.ex:65: OAuth2.Request.request!/6
2021-09-06T17:25:51.061383+00:00 app[web.1]: (bors 0.1.0) lib/github/oauth2/oauth2.ex:50: BorsNG.GitHub.OAuth2.get_user!/1
2021-09-06T17:25:51.061383+00:00 app[web.1]: (bors 0.1.0) lib/web/controllers/auth_controller.ex:77: BorsNG.AuthController.callback/2
2021-09-06T17:25:51.061384+00:00 app[web.1]: (bors 0.1.0) lib/web/controllers/auth_controller.ex:3: BorsNG.AuthController.action/2
2021-09-06T17:25:51.061384+00:00 app[web.1]: (bors 0.1.0) lib/web/controllers/auth_controller.ex:3: BorsNG.AuthController.phoenix_controller_pipeline/2
2021-09-06T17:25:51.061384+00:00 app[web.1]: (phoenix 1.5.12) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
2021-09-06T17:25:51.061385+00:00 app[web.1]: (bors 0.1.0) lib/web/bors_ng/endpoint.ex:1: BorsNG.Endpoint.plug_builder_call/2
2021-09-06T17:25:51.061385+00:00 app[web.1]: (bors 0.1.0) lib/web/bors_ng/endpoint.ex:1: BorsNG.Endpoint.call/2
2021-09-06T17:25:51.227140+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=borsts.herokuapp.com request_id=4dbc096c-9f5a-4ad9-bae0-1601f144dbce fwd="213.238.192.194" dyno=web.1 connect=0ms service=2ms status=200 bytes=15347 protocol=https

3 posts were split to a new topic: Is there a way to debug whether bors is receiving commands?