-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Store method doesn't work (returns 404) #677
Comments
Hey, I can't see any weird behavior with a new Laravel + Jetstream installation. Can you share a simple repo demonstrating this issue? |
Sorry for late response. Here is demo repo https://github.com/zaminhub/jetstream.test.git |
Hello @itsgoingd Did you check the demo repo above? |
Hey, sorry, forgot about this one, thanks for reminding me. Turns out this is quite a convoluted issue. I will try to explain. The code that triggers this behavior is this line in your javascript code: This ends up sending a POST request with an empty On server-side, Clockwork checks the method of the incoming request, very early in the processing. To do so, we call Since your app is sending request with an empty https://github.com/symfony/http-foundation/blob/7.1/Request.php#L1166-L1168 Well, a good question is, why does this work without Clockwork? Turns out, Laravel includes a middleware, that replaces empty strings in the request by nulls. Now when we call the same https://github.com/symfony/http-foundation/blob/7.1/Request.php#L1156-L1158 The issue with Clockwork installed is the execution order, which looks like this:
TL;DR I'm not sure if or how we want to fix this in Clockwork, but you can trivially fix this on your side, by adding POST as default value to |
Stack Laravel 10.43 + Jetstream v4.22 (inertia v0.6.11 + vue v3.2.31). php v8.1
After clockwork package installed the store methods of any resourse controller doesn't work and returns 404 page not found response.
After removing clockwork package the problem disappears.
I suppose this is because headers which should be "Accept: application/json", but I am not sure. Somehow clockwork package does remove this header from all post requests, but not from put/patch request.
The text was updated successfully, but these errors were encountered: