Patch requests always responds with a 405 status with Nextjs 14 #3152
-
Hey guys, not sure what I'm doing wrong but no matter what the route is, my patch request always responds with a 405 (Method Not Allowed) status. I've tried everything I can think of but it just refused to allow me to send patch requests. I change the route to post and it works fine, so I'm really not sure what's going on. For example, this code always returns a 405
But, if all I do is change it to be a post request, like this:
then it works fine. For reference, on the client side I'm calling:
Any help would be greatly appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Well, I it out a couple minutes after posting this question I figured it out! Turns out it was just a dumb mistake I was making, I had completely forgotten that you need to wrap the different Nextjs request types like so:
All I had to do was add |
Beta Was this translation helpful? Give feedback.
Well, I it out a couple minutes after posting this question I figured it out! Turns out it was just a dumb mistake I was making, I had completely forgotten that you need to wrap the different Nextjs request types like so:
All I had to do was add
export const PATCH = handle(app);
and now it works fine. I've never asked questions on Github before so I'm not sure if I should take this down or not? I'll leave it up for now in case anyone else has this problem in the future, if I should take it down someone just let me know and I will! Cheers!