nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Error 500 on unmatched route

Open huang-julien opened this issue 1 year ago • 1 comments

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

huang-julien avatar Jul 22 '22 15:07 huang-julien

Yes, this error happened when I deployed a nuxt app to vercel-edge.

so1ve avatar Aug 07 '22 08:08 so1ve

Might be related to https://github.com/unjs/nitro/issues/717

Hebilicious avatar Jul 01 '23 00:07 Hebilicious

Lets track via https://github.com/unjs/nitro/issues/717 unless you have another reproduction.

pi0 avatar May 16 '24 20:05 pi0