framework
framework copied to clipboard
404 Cannot find any route matching
Environment
- Operating System:
Darwin - Node Version:
v16.16.0 - Nuxt Version:
3.0.0-rc.12 - Nitro Version:
0.6.0 - Package Manager:
[email protected] - Builder:
vite - User Config:
modules,ssr - Runtime Modules:
@nuxtjs/[email protected] - Build Modules:
-
Reproduction
https://github.com/qucode1/nuxt-api-route-issue/blob/master/server/api/reset-password.post.ts
Describe the bug
Server api routes that return undefined or nothing at all will run, but the server will return an error that does not help finding the issue:
export default defineEventHandler(async (event) => {
try {
console.log('resetPassword')
return
} catch (error) {
console.log('reset password error', { error })
return sendError(event, createError({
...error,
statusMessage: error.message,
}))
}
})
to fix the issue you need to use event.res.end(), return null or anything else.
404 Cannot find any route matching /api/reset-password

Additional context
No response
Logs
No response