Closed chasers closed 5 years ago
Note: all my other db ops are working.
Seems like the :app
key is not included in your release. I assume something has changed in elixir/phoenix since I released this library, and using Mix.Phoenix.base/0
is no longer recommended.
I'll update the phoenix-1-4 branch with a fix for this. I've already written Pow with a much more reliable way to fetch web_module.
Ok, pull the PhoenixOauth2Provider from git with the most recent commit, and update the config with :module
:
config :phoenix_oauth2_provider, PhoenixOauth2Provider,
current_resource_owner: :user,
repo: Logflare.Repo,
resource_owner: Logflare.User,
grant_flows: ~w(authorization_code),
use_refresh_token: true,
default_scopes: ~w(public),
optional_scopes: ~w(read write),
revoke_refresh_token_on_use: true,
module: Logflare
I'm in the process of rewritten both of these libraries completely. It was build with Phoenix 1.2/1.3 in mind, and with some bad practices as I was still pretty green. It'll take a bit of time to get it all up to date, but by then this bug will be removed. Let's keep this issue open until I've applied a fix for this.
Dude you're awesome! Working now on prod too!
Please keep this updated :) I definitely found your libraries to be more approachable plus having the routes and templates built in was one less thing to figure out.
Going to need an actual login / registration form soon so I'll probably go with Pow.
v0.5.0
has been released at last!
Hey turns out I have this problem in production again. Config is now as you said...
config :logflare, ExOauth2Provider,
repo: Logflare.Repo,
resource_owner: Logflare.User,
grant_flows: ~w(authorization_code),
use_refresh_token: true,
default_scopes: ~w(public),
optional_scopes: ~w(read write),
revoke_refresh_token_on_use: true
config :logflare, PhoenixOauth2Provider,
current_resource_owner: :user,
web_module: LogflareWeb
Any ideas?
Is the error stacktrace the same as the first one you experienced?
Yeah
00:17:43.612 [error] #PID<0.756.57> running LogflareWeb.Endpoint (connection #PID<0.967.57>, stream id 1) terminated
Server: logflare.app:80 (http)
Request: GET /oauth/authorize?client_id=d8a8af24ada66bfa29477d746d74ae7a8833d80019c6fa285f07fe6159491a5f&redirect_uri=https%3A%2F%2Fwww.cloudflare.com%2Fapps%2Foauth%2F&response_type=code&scope=read+write
** (exit) an exception was raised:
** (KeyError) key :app not found in: [aliases: [], build_embedded: false, build_per_environment: true, build_scm: Mix.SCM.Path, config_path: "config/config.exs", consolidate_protocols: true, default_task: "run", deps: [], deps_path: "deps", elixirc_paths: ["lib"], erlc_paths: ["src"], erlc_include_path: "include", erlc_options: [:debug_info], lockfile: "mix.lock", preferred_cli_env: [], start_permanent: false]
(elixir) lib/keyword.ex:389: Keyword.fetch!/2
(phoenix_oauth2_provider) lib/phoenix_oauth2_provider/config.ex:26: PhoenixOauth2Provider.Config.get_from_app_env/2
(phoenix_oauth2_provider) lib/phoenix_oauth2_provider/config.ex:15: PhoenixOauth2Provider.Config.get/3
(phoenix_oauth2_provider) lib/phoenix_oauth2_provider/controller.ex:32: PhoenixOauth2Provider.Controller.__put_web_module_view__/2
(phoenix_oauth2_provider) lib/phoenix_oauth2_provider/controllers/authorization_controller.ex:1: PhoenixOauth2Provider.AuthorizationController.phoenix_controller_pipeline/2
(logflare) lib/logflare_web/endpoint.ex:1: LogflareWeb.Endpoint.instrument/4
(phoenix) lib/phoenix/router.ex:275: Phoenix.Router.__call__/1
(logflare) lib/logflare_web/endpoint.ex:1: LogflareWeb.Endpoint.plug_builder_call/2
Ok, I think I found the issue, let me just do some tests here with releases to make sure I got a fix.
The issue is that :app
key is not available in releases 😞 Working on a 5.0.1
release that mitigates the issue.
Ok, v0.5.1
has been released, so now :otp_app
has to be passed explicitly. I've opened a PR at logflare.
Just got everything working on dev and deployed this to prod. I'm getting an interal server error when I try to create an application. Seems as though the create went through to the db though. Here is the log message:
Code is on master here: https://github.com/Logflare/logflare
Any help is very much appreciated!