mirego / accent

The first developer-oriented translation tool. True asynchronous flow between translators and your team.
https://www.accent.reviews
BSD 3-Clause "New" or "Revised" License
1.26k stars 96 forks source link

Error on Google/Github auth #105

Closed DRSchlaubi closed 5 years ago

DRSchlaubi commented 5 years ago

I tried to setup github and google auth and after finding out that you need to actually specify your providers in the WEBAPP_AUTH_PROVIDERS=google,github ENV variable I finally got the dummy login disabled. But after that I kept receiving this errors

accent         | ** (exit) an exception was raised:
accent         |     ** (UndefinedFunctionError) function Accent.AuthController.request/2 is undefined or private
accent         |         (accent) Accent.AuthController.request(%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, before_send: [#Function<1.112466771/1 in Plug.Logger.call/2>], body_params: %{}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "i18n.thurl.icu", method: "GET", owner: #PID<0.2772.0>, params: %{"provider" => "google_oauth2", "scope" => "email profile"}, path_info: ["auth", "google_oauth2"], path_params: %{"provider" => "google_oauth2"}, port: 443, private: %{Accent.Router => {[], %{Absinthe.Plug => [], Absinthe.Plug.GraphiQL => ["graphiql"]}}, :phoenix_action => :request, :phoenix_controller => Accent.AuthController, :phoenix_endpoint => Accent.Endpoint, :phoenix_format => "html", :phoenix_layout => {Accent.LayoutView, :app}, :phoenix_pipelines => [:browser], :phoenix_router => Accent.Router, :phoenix_view => Accent.AuthView}, query_params: %{"scope" => "email profile"}, query_string: "scope=email%20profile", remote_ip: {172, 24, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"}, {"accept-encoding", "gzip"}, {"accept-language", "de,en;q=0.9,de-DE;q=0.8,en-US;q=0.7"}, {"cdn-loop", "cloudflare"}, {"cf-connecting-ip", "193.159.43.121"}, {"cf-ipcountry", "DE"}, {"cf-ray", "4f4cfd37de065994-VIE"}, {"cf-visitor", "{\"scheme\":\"https\"}"}, {"connection", "close"}, {"cookie", "__cfduid=d77d741f4ed8b80908fca0446c4f88e621562856846"}, {"host", "i18n.thurl.icu:443"}, {"upgrade-insecure-requests", "1"}, {"user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}, {"x-forwarded-for", "172.68.50.191"}, {"x-forwarded-host", "i18n.thurl.icu"}, {"x-forwarded-proto", "https"}], request_path: "/auth/google_oauth2", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}, {"x-request-id", "FbBvKrLVSJc-DWYAAACE"}, {"x-frame-options", ""}, {"x-xss-protection", "1; mode=block"}, {"x-content-type-options", "nosniff"}, {"x-download-options", "noopen"}, {"x-permitted-cross-domain-policies", "none"}, {"cross-origin-window-policy", "deny"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, %{"provider" => "google_oauth2", "scope" => "email profile"})

Even if I don't know anything about elexir I tried to figure out what the issue is and I found this line here very quickly https://github.com/mirego/accent/blob/a800fad039a6f6c46ce4836a505d1457deda1b6b/lib/web/router.ex#L65 But it looks like the Method request is not present in this controller file here https://github.com/mirego/accent/blob/master/lib/web/controllers/auth_controller.ex

So I took a look at the histories but couldn't find any version of those files where that method would be there so I am wondering if it's just a configuration issue my env:


      - APP_NAME=accent
      - APP_VERSION=1.1.0
      - DATABASE_URL=postgres://postgres@postgresql:5432/accent_development
      - WEBAPP_AUTH_PROVIDERS=google,github
      - GOOGLE_API_CLIENT_ID=x.apps.googleusercontent.com
      - GOOGLE_API_CLIENT_SECRET=x
      - GITHUB_CLIENT_ID=x
      - GITHUB_CLIENT_SECRET=x
      - MIX_ENV=prod
      - PORT=4200
      - CANONICAL_HOST=i18n.thurl.icu
      - API_HOST=https://api.i18n.thurl.icu
      - API_WS_HOST=wss://api.i18n.thurl.icu
      - WEBAPP_URL=https://i18n.thurl.icu
      - MAILER_FROM=noreply@thurl.icu
      - SMTP_ADDRESS=smtp.sendgrid.net
      - SMTP_PORT=465
      - SMTP_USERNAME=apikey```
queer commented 5 years ago

But it looks like the Method request is not present in this controller file here

There is no :request function defined, because the Ueberauth plug is supposed to handle that.

Are you trying to run this in development or in production? Because that will affect how you configure it.

DRSchlaubi commented 5 years ago

I try to run it in production

queer commented 5 years ago

Are you running it manually? Using the mirego/accent Docker image? Something else?

DRSchlaubi commented 5 years ago

Is there an official one on the Docker hub? Cuz i built it my self using make build and then ran it using docker-compose

queer commented 5 years ago

Use https://hub.docker.com/r/mirego/accent; you should have better luck than doing it yourself.

DRSchlaubi commented 5 years ago

You should definetly mention this image somewehre in the readme. Thx for your help will try it

DRSchlaubi commented 5 years ago

Ok I got the Docker image working but from now on the webapp just says that's currently in Maintenance

DRSchlaubi commented 5 years ago

Already waited for ember to compile the page

simonprev commented 5 years ago

The new way to package the Ember app should fix this issue. The providers are also inferred from the environment variables and evaluated at runtime so function Accent.AuthController.request/2 is undefined should also be fixed.

I’m closing this, don’t hesitate to reopen an issue if you have other problems setting up the projet 😄