nitro
nitro copied to clipboard
Error 500 on unmatched route
Environment
node 16 nitropack: 0.4.12
Reproduction
Unmatched route throws a 500 error instead of 404.
When a directory such as routes/test has no file and a request to /test or /hello is done, an error is thrown and a 500 response is sent instead of a 404. However if a index.get.ts is available in /routes/test, the error is normally handled with a method not allowed error.
Describe the bug
{"url":"/api/technicals/general","statusCode":500,"statusMessage":"Internal Server Error","message":"Cannot read properties of undefined (reading 'post')","stack":["at createError (./node_modules/h3/dist/index.mjs:191:15)","at Server.nodeHandler (./node_modules/h3/dist/index.mjs:381:21)"]}
Additional context
No response
Logs
No response
Yes, this error happened when I deployed a nuxt app to vercel-edge.
Might be related to https://github.com/unjs/nitro/issues/717
Lets track via https://github.com/unjs/nitro/issues/717 unless you have another reproduction.