Skip to content

404 Cannot find any route matching #15293

@qucode1

Description

@qucode1

Environment


  • Operating System: Darwin
  • Node Version: v16.16.0
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: pnpm@6.11.0
  • Builder: vite
  • User Config: modules, ssr
  • Runtime Modules: @nuxtjs/tailwindcss@6.1.2
  • 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
Bildschirmfoto 2022-10-28 um 18 00 14

Additional context

No response

Logs

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions