Closed ltd closed 2 years ago
Hi @ltd yeah, we are aware of this. We are exploring using Releases for our projects. 👍 Meanwhile if you have time to help with a Pull Request, please dive in!
The quick workaround for the moment is for the library user to add :mix to extra_applications, and as hacks go, its not that gross. I think config strategy is highly personable. I would probably just move it to compile time.
`
if Mix.env() in [:test] do
def injectpoison(), do: ElixirAuthGithub
else
def injectpoison(), do: HTTPoison
end `
This has finally bitten us when attempting to deploy Auth to Fly.io https://github.com/dwyl/auth/pull/173 We get the following error:
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info]Server: auth.dwyl.com:80 (http)
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info]Request: GET /auth/github/callback?code=code&state=https%3A%2F%2Fauth.dwyl.com%2Fprofile%3Fauth_client_id=id
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info]** (exit) an exception was raised:
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] ** (UndefinedFunctionError) function Mix.env/0 is undefined (module Mix is not available)
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] Mix.env()
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (elixir_auth_github 1.6.0) lib/elixir_auth_github.ex:18: ElixirAuthGithub.inject_poison/0
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (elixir_auth_github 1.6.0) lib/elixir_auth_github.ex:65: ElixirAuthGithub.github_auth/1
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (auth 1.6.5) lib/auth_web/controllers/auth_controller.ex:136: AuthWeb.AuthController.github_handler/2
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (auth 1.6.5) lib/auth_web/controllers/auth_controller.ex:1: AuthWeb.AuthController.action/2
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (auth 1.6.5) lib/auth_web/controllers/auth_controller.ex:1: AuthWeb.AuthController.phoenix_controller_pipeline/2
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (phoenix 1.6.5) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
2022-02-07T09:39:10Z app[ba4a82f7] cdg [info] (auth 1.6.5) lib/auth_web/endpoint.ex:1: AuthWeb.Endpoint.plug_builder_call/2
Given this p1
as it's blocking Fly.io https://github.com/dwyl/auth/pull/173 ... 🔥
Will try an work on it this evening... ⏳ 🤞
PR #58 assigned to @SimonLab for review. 🙏
https://hex.pm/packages/elixir_auth_github/1.6.1 contains this update. Thanks again @ltd for drawing our attention to this.
Mix.env() is now taboo to use at runtime. MIx is not available from a built release. The inject_poison() function will raise.