You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.There is an api route /api/rest/upload in the project for file upload. When I accidentally enter the wrong routing address, such as api/ant/upload, an error message appears: TypeError: s is not a function.
Current vs. Expected behavior
There is an api route /api/rest/upload in the project for file upload. When I accidentally enter the wrong routing address, such as api/ant/upload, an error message appears: TypeError: s is not a function. This is not true. Expected to happen. At the same time, if the route cannot be recruited, there should be a friendly response. The request status and code should be 404. At the same time, different response information should be returned under different data type requests to provide a friendly reminder to the developer.
Verify canary release
I verified that the issue exists in the latest Next.js canary release
I have a couple of logs with the same error on a webhook I exposed.
To elaborate on the repro steps, if you see a 405 error you probably have a middleware on top (ie next-auth or next-intl's middlewares), so just make sure the route you're testing against doesn't have one.
Here's a one line repro curl https://demo.vercel.store/api --form foo="bar"
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/skyddyyu/api-route-mismatch
To Reproduce
1.There is an api route /api/rest/upload in the project for file upload. When I accidentally enter the wrong routing address, such as api/ant/upload, an error message appears: TypeError: s is not a function.
Current vs. Expected behavior
There is an api route /api/rest/upload in the project for file upload. When I accidentally enter the wrong routing address, such as api/ant/upload, an error message appears: TypeError: s is not a function. This is not true. Expected to happen. At the same time, if the route cannot be recruited, there should be a friendly response. The request status and code should be 404. At the same time, different response information should be returned under different data type requests to provide a friendly reminder to the developer.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Middleware / Edge (API routes, runtime)
Additional context
No response
The text was updated successfully, but these errors were encountered: