Phoenix 1.18 Ash authentication error
I'm seeing the following error when I try to access
/sign-in
or /register
on a new application I'm playing with.
But /auth/user/magic_link
loads just fine.
Any ideas where I could have made a mistake?
Versions:
Phoenix: 1.8.0-rc.3
Ash: 3.5.15
Ash authentication: 4.9.0
Ash authentication phoenix: 2.7.019 Replies
did you just install everything with igniter from the ash-hq page?
just trying to understand the best way to reproduce
I created the new project as a regular phoenix project and than added ash using the commands provided in the ash-hq page, using the "already have an app" option
this is a brand new app. so no customization done at this point
Ok, let me run the same than
ah, two things. I'm following the mulitenancy (context) and only enabled the magic link strategy
not sure if that matters
is there an option for multitenancy in the installer that you used or does that mean you edited the resources to add the multitenancy config?
I added this to the resource
I followed this tutorial https://hexdocs.pm/ash/multitenancy.html#context-multitenancy
So far I'm unable to reproduce, have you changed anything else in the code?
The error would suggest maybe something in the pipeline is setting the current_user before the default hook is run
this is the pipeline:
and the route
I can start over and diff the results to try to find the problem. Thanks for your assistance though
That looks pretty standard, if you find that after installing with igniter in a new project you get the same error, maybe you can push that code somewhere so we can clone it and look at it directly
sounds good.
btw, did you add phoenix with igniter?
fyi this is how I started the project mix phx.new myapp --module MyApp --no-dashboard --no-ecto
I did it this way mix phx.new myapp without the extra flags
why did you use the no-ecto flag?
I think AshPostgres will setup correctly in both cases. But I've only used it with Pheonix and Ecto before.
I thought I didn't need ecto config and what not after I installed ash, given ash would configure everything needed
you are probably right
It's mostly the same setup though, we only put some extra things in the repo module IIRC
qq about the multi tenancy. when you use context, users are created directly in the tenant schema, rendering the users table in the public schema useless?
pretty much, in the applications I worked in the users were always global, because most of the time you want to use the user to then see which org they belong to.
I'm setting up 1.18 rc3 via the command generated on the webpage, will post if I get the same error.
The one on the webpage reinstalls the 1.17 installer 😅
We should make it detect a newer one and ask the user if they want to use the new one
Yeah, I just fetched the bash via curl and checked what it did and changed to 1.18. But it would probably be good to have some kind of information on the webpage on what version it fetches (maybe an option in the selector?)
@barnabasj just to give you an update, I couldn't reproduce the error either so far.