Open
Description
Environment
- Operating System:
Darwin
- Node Version:
v23.10.0
- Nuxt Version:
3.17.5
- CLI Version:
3.25.1
- Nitro Version:
2.11.12
- Package Manager:
pnpm@10.12.1
- Builder:
-
- User Config:
extends
,modules
,devtools
,app
,colorMode
,ui
,runtimeConfig
,future
,compatibilityDate
,typescript
,telemetry
,eslint
- Runtime Modules:
@nuxt/eslint@1.4.1
,@nuxt/fonts@0.11.4
,@nuxt/ui@2.22.0
,@vueuse/nuxt@13.3.0
,@nuxt/image@1.10.0
,@nuxtjs/robots@5.2.10
,@nuxtjs/sitemap@7.2.10
,nuxt-security@2.2.0
- Build Modules:
-
Reproduction
- Create a new nuxt project
- Start dev server
- Add a test.get.ts api route that throws an error like this
throw createError({
statusCode: 500,
message: 'Internal server error'
})
- Update app.vue to do a request to that api like this
<script setup lang="ts">
const { data } = await useFetch('/api/test', {
method: 'get',
});
</script>
<template>
<div>
test
{{ data }}
</div>
</template>
- Add plugins folder in server with the followign content
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('error', (error, { event }) => {
console.error('Global error caught:', error)
console.error('Global error event caught:', event)
})
})
Describe the bug
Hey,
You will see when following the above procedure that the plugin will not be triggered until your restart dev server.