Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get the demo to run #51

Closed
stabenfeldt opened this issue Mar 21, 2024 · 14 comments · Fixed by #52
Closed

Can't get the demo to run #51

stabenfeldt opened this issue Mar 21, 2024 · 14 comments · Fixed by #52
Labels
help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue starter A beginner-friendly issue that is a good starting point for a new person T5m Quick tasks that take 5 mins or less. See: GTD 2 min rule. technical A technical issue that requires understanding of the code, infrastructure or dependencies user-feedback Feedback from people using the App

Comments

@stabenfeldt
Copy link

Hi guys,

Thanks for writing this software! Just what I need to convince my colleagues at this MS-heavy place.
I tried to clone the repo and run the demo, but that did't work out of the box:

` mix deps && mix phx.server``
image

@nelsonic
Copy link
Member

Hi @stabenfeldt 👋
You definitely need the environment variables to be set for it to run. 👌
Have you defined them as per the docs? 💭
https://github.com/dwyl/elixir-auth-microsoft?tab=readme-ov-file#2-create-an-app-registration-in-azure-active-directory-

@nelsonic nelsonic added help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies starter A beginner-friendly issue that is a good starting point for a new person user-feedback Feedback from people using the App T5m Quick tasks that take 5 mins or less. See: GTD 2 min rule. labels Mar 21, 2024
@stabenfeldt
Copy link
Author

stabenfeldt commented Mar 21, 2024

Hi @nelsonic,

Yes, I forgot to mention that I have them set:

➜  elixir-auth-microsoft git:(main) ✗ cd demo
direnv: loading ~/Work/elixir-auth-microsoft/demo/.envrc
direnv: export +MICROSOFT_CLIENT_ID +MICROSOFT_CLIENT_SECRET +MICROSOFT_SCOPES_LIST

@nelsonic
Copy link
Member

Ok. Please run:

mix setup

That :http error indicates that Erlang/OTP is not fully available which is bizarre if the mix command works at all ...

Please share your error messages as you see them. 👌

@stabenfeldt
Copy link
Author

mix setup ran without problems
mix phx.server stopped at:

src/ssl_verify_fun_cert_helpers.erl:56:1: Warning: function select_extension/2 is unused
%   56| select_extension(Id, Extensions) ->
%     | ^

src/ssl_verify_fun_cert_helpers.erl:64:1: Warning: function extract_dns_names_from_alt_names/2 is unused
%   64| extract_dns_names_from_alt_names([ExtValue | Rest], Acc) ->
%     | ^

could not compile dependency :ssl_verify_fun, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ssl_verify_fun --force", update it with "mix deps.update ssl_verify_fun" or clean it with "mix deps.clean ssl_verify_fun"

@stabenfeldt
Copy link
Author

stabenfeldt commented Mar 21, 2024

mix deps.compile ssl_verify_fun --force gave the same error, but
mix deps.update ssl_verify_fun got all the deps installed. 🎉

@stabenfeldt
Copy link
Author

mix phx.server ended here:

[info] Running AppWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.29.tgz
[info] Access AppWeb.Endpoint at http://localhost:4000
[error] Task #PID<0.2777.0> started from AppWeb.Endpoint terminating
** (UndefinedFunctionError) function :http_util.timestamp/0 is undefined (module :http_util is not available)
    (inets 9.1) :http_util.timestamp()
    (inets 9.1) httpc.erl:750: :httpc.handle_request/9
    (esbuild 0.5.0) lib/esbuild.ex:297: Esbuild.fetch_body!/1
    (esbuild 0.5.0) lib/esbuild.ex:209: Esbuild.install/0
    (esbuild 0.5.0) lib/esbuild.ex:189: Esbuild.install_and_run/2
    (phoenix 1.6.14) lib/phoenix/endpoint/watcher.ex:19: Phoenix.Endpoint.Watcher.watch/2
    (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
Function: &Phoenix.Endpoint.Watcher.watch/2
    Args: ["esbuild", {Esbuild, :install_and_run, [:default, ["--sourcemap=inline", "--watch"]]}]

@stabenfeldt
Copy link
Author

 elixir --version
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit] [dtrace]

Elixir 1.15.7 (compiled with Erlang/OTP 24)

@stabenfeldt
Copy link
Author

➜  demo git:(main) ✗ asdf --version
v0.14.0
➜  demo git:(main) ✗ asdf list
elixir
  1.14.5-otp-26
  1.14.5
  1.15.7-otp-26
 *1.15.7
  1.16
erlang
  No versions installed

@LuchoTurtle
Copy link
Member

Hey @stabenfeldt !

Super sorry you're having trouble running the demo! It seems that mix.lock has outdated dependencies.
I'm pushing a PR asap to the main branch so you have it working!

@LuchoTurtle
Copy link
Member

Opened #52 to fix this issue. It works on that branch. Waiting on @nelsonic to approve and merge the changes.

If you can't wait for it to get merged, you can checkout the branch and test the demo yourself :)

Tell us if it's working =D

@stabenfeldt
Copy link
Author

Thanks for helping out, @LuchoTurtle and @nelsonic!

The application starts without any problems now, but it throws an exception when I press the "Sign in" button.
image

@LuchoTurtle
Copy link
Member

LuchoTurtle commented Mar 22, 2024

🤔 Interesting, that doesn't seem to be happening to me.
The only related issue I can find is danhper/plug-navigation-history#6.

Can you provide more details? Are you using Chrome or Firefox (or any other browser)? (perhaps dwyl/auth_plug#28 may provide more insights on getting this resolved)

What is your app name? We usually give our apps ":app" for simplicity's sake but there's a small chance it may be related to the issue you've raised. The plug dependency uses cookies to store sessions which seems to have a max size limit.

Have you tried this in an anonymous window (to clear all cookies)? Maybe there seems to be a conflict with other sessions on other websites, as well 🤔

Here's what mine looks like when inspecting the cookies:

image

@nelsonic
Copy link
Member

Issue automatically closed by merging PR #52 … ✅
Reopening for further feedback from @stabenfeldt 💭

@nelsonic nelsonic reopened this Mar 22, 2024
@stabenfeldt
Copy link
Author

I didn't get the demo to work, but when I followed your guide I were able to add SSO to my existing app.
🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue starter A beginner-friendly issue that is a good starting point for a new person T5m Quick tasks that take 5 mins or less. See: GTD 2 min rule. technical A technical issue that requires understanding of the code, infrastructure or dependencies user-feedback Feedback from people using the App
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants