no route found for POST /admin

With 1 ash_admin("/admin")` in the router.ex, I can open the admin site and see it perform some actions, but for some others, I get "no route found for POST /admin ". These are some simple read actions with a couple of arguments that I'm running, if that matters. Thanks.
38 Replies
ZachDaniel
ZachDaniel2y ago
Hm…it shouldn’t be using a post request… Do you have ash_admin inside of a scope?
Jason
JasonOP2y ago
under 'scope "/"' scope "/" do # Pipe it through your browser pipeline # pipe_through [:browser] if Mix.env() in [:dev, :test] do pipe_through([:browser]) else pipe_through([:browser, :admin_basic_auth]) end ash_admin("/admin")
ZachDaniel
ZachDaniel2y ago
Hm…that seems fine What links do you click that get you to that error message?
Jason
JasonOP2y ago
I tried 3 read actions. Two that require user id as argument give me that error. One without rums fine
ZachDaniel
ZachDaniel2y ago
Hmm…is liveview set up on your app? Do you have console js errors?
Jason
JasonOP2y ago
Yes, my app has Liveview setup. Here is the console error. :my_feed action returns the query results properly (including the calculated my_feed_eligible_by), when run manually from iex.
POST http://localhost:3000/admin?api=Sheets&resource=Sheet&table=&action_type=read&action=my_feed 404 (Not Found)
POST http://localhost:3000/admin?api=Sheets&resource=Sheet&table=&action_type=read&action=my_feed 404 (Not Found)
<my_feed>
read :my_feed do
description "Get the feed of sheets for a user"

argument :user_id, :uuid do
allow_nil? false
end

prepare build(
sort: [inserted_at: :desc]
)

filter expr(my_feed_eligible_by(user_id: arg(:user_id)))
end
read :my_feed do
description "Get the feed of sheets for a user"

argument :user_id, :uuid do
allow_nil? false
end

prepare build(
sort: [inserted_at: :desc]
)

filter expr(my_feed_eligible_by(user_id: arg(:user_id)))
end
Jason
JasonOP2y ago
No description
ZachDaniel
ZachDaniel2y ago
This looks like it might be a bug in ash_admin 😓 Might need to look at the form for read action arguments and make sure it’s doing the right thing @Jason did you ever figure this out?
Jason
JasonOP2y ago
No, not really 🙂
ZachDaniel
ZachDaniel2y ago
😢 well, you're not the only one with the issue now
Jason
JasonOP2y ago
yay!
ZachDaniel
ZachDaniel2y ago
but we still can't figure it out 😆
Jason
JasonOP2y ago
:thinkies:
drumusician
drumusician2y ago
yeah, the same issue here. I'll see if I can debug further what is causing this So I noticed that the table param is empty here, I see that on my end aswell @Jason do you have graphql setup in your app?
Jason
JasonOP2y ago
No
drumusician
drumusician2y ago
ok, because I had a hunch that that might be the issue because I have, but we can rule that out then so for me it happened in the create action first, but I also have the same issue when I do a lookup by ID
ZachDaniel
ZachDaniel2y ago
It seems tied to submitting any form Like it’s trying to submit forms over http instead of over the socket
drumusician
drumusician2y ago
can it be related to a change in Phoenix 1.7? @Jason what version of liveview do you have in your app?
ZachDaniel
ZachDaniel2y ago
it could potentially, yeah. Although we're using it with Phoenix 1.7 well enough. Perhaps there is some liveview setup that is incorrect in your app? (that our guide should have told you to do, not saying its your fault 😆)
drumusician
drumusician2y ago
ok, got it working 😃 I started comparing versions between your Twitter app and my app, so I was using latest and greatest liveview in my app, and that doesn't work apparently 😉 I did override, so it was my fault 0.18.3 seems to work, not sure if later versions will also work, but might . 0.19.5 does not
ZachDaniel
ZachDaniel2y ago
very interesting... need to look at their release notes thank you for hunting this down, we definitely want to make ash_admin work against the latest
Jason
JasonOP2y ago
0.19.3 Unfortunately I'm still getting the same error message. 😦
ZachDaniel
ZachDaniel2y ago
Yeah, @drumusician resolved it by downgrading, so something in the latest versions of LV is causing the issue now that we know its versions causing this though, I can reproduce, will fix 🙂
Jason
JasonOP2y ago
I see. Thank you!!
ZachDaniel
ZachDaniel2y ago
of course now that I'm upgrading I'm having some other weird error 😢 its routing events to the parent liveview for some reason
Jason
JasonOP2y ago
That's odd. That didn't happen to me.
ZachDaniel
ZachDaniel2y ago
okay, so I just blasted out the full removal of surface and I believe that should also have fixed your issue @Jason and @drumusician however, it was a massive amount of code changed so there will likely be bugs. Mind trying the main branch?
Jason
JasonOP2y ago
sure. thanks! Sorry the error still occurs. Same error And I get this too. (UndefinedFunctionError) function Ash.Actions.Helpers.restrict_field_access/2 is undefined or private Should I upgrade any other dependency?
* ash 2.13.2 ([email protected]:ash-project/ash.git) (mix)
locked at b9abe2a
ok
* ash_admin 0.8.1 (Hex package) (mix)
locked at 0.8.1 (ash_admin) 1f4f7eca
ok
* ash_authentication 3.11.6 (Hex package) (mix)
locked at 3.11.6 (ash_authentication) 506b72ac
ok
* ash_authentication_phoenix 1.7.2 (Hex package) (mix)
locked at 1.7.2 (ash_authentication_phoenix) 76edd8c4
ok
* ash_phoenix 1.2.14 (Hex package) (mix)
locked at 1.2.14 (ash_phoenix) 1a801b31
ok
* ash_postgres 1.3.30 (Hex package) (mix)
* ash 2.13.2 ([email protected]:ash-project/ash.git) (mix)
locked at b9abe2a
ok
* ash_admin 0.8.1 (Hex package) (mix)
locked at 0.8.1 (ash_admin) 1f4f7eca
ok
* ash_authentication 3.11.6 (Hex package) (mix)
locked at 3.11.6 (ash_authentication) 506b72ac
ok
* ash_authentication_phoenix 1.7.2 (Hex package) (mix)
locked at 1.7.2 (ash_authentication_phoenix) 76edd8c4
ok
* ash_phoenix 1.2.14 (Hex package) (mix)
locked at 1.2.14 (ash_phoenix) 1a801b31
ok
* ash_postgres 1.3.30 (Hex package) (mix)
ZachDaniel
ZachDaniel2y ago
🤔 I'd upgrade anything ash related if you can 😆 How did you update ash_admin? If you're on the main branch currently, make sure to do mix deps.update ash_admin to go to the latest ref of main
Jason
JasonOP2y ago
It's working!! after getting ash_admin, authentication, and authentication_phoenix from github.
drumusician
drumusician2y ago
also checking out the latest main and will test
drumusician
drumusician2y ago
getting this error now. I am not using everything from github yet. Do you know which one this can be?
No description
drumusician
drumusician2y ago
hmm this actually seems like it is ash_admin itself. It is when editing a resource
ZachDaniel
ZachDaniel2y ago
Yeah this is probably just a bug from the changeover What’s the file/line number? I bet it’s just a typo of attributes to attribute
drumusician
drumusician2y ago
No description
ZachDaniel
ZachDaniel2y ago
okay, try again 🙂
drumusician
drumusician2y ago
awesome! Working now I'll keep using main for the time being and will let you know if I encounter anything else
ZachDaniel
ZachDaniel2y ago
🔥

Did you find this page helpful?