Next.js (16.0.3) | useMutation | An unexpected response was received from the server.
Hey guys, I am trying to move from next 15.3.4 -> 16.0.3 and react 19 -> 19.2 and I have been experiencing some errors that I can't figure out how to solve.
What was working before the version bump, now throws the error you can see commented out and skips the onSuccess.
The only way I have managed to bypass the problem is to switch to onSettled but that doesn't feel like the right solution...
Thank you if you got the time to read this and please let me know if I should provide more details.
Thank you if you got the time to read this and please let me know if I should provide more details.
1 Reply
harsh-harlequinOP•2w ago
Hello again! I managed to solve it by founding this github thread: https://github.com/vercel/next.js/issues/50659#issuecomment-1846046743
Apparently my middleware was overwriting the request headers.
Hope its useful to others as well.
GitHub
vercel/next.js
The React Framework. Contribute to vercel/next.js development by creating an account on GitHub.