I wanted to use the Error Hook as described in the docs but I does not seem work and I am getting this error:
Argument of type '"apollo:error"' is not assignable to parameter of type 'HookKeys<RuntimeNuxtHooks>'.
FILE /var/www/common/plugins/apolloErrorHandler.ts:4:18
2 |
3 | export default defineNuxtPlugin(nuxtApp => {
> 4 | nuxtApp.hook('apollo:error', (error: ErrorResponse) => {
| ^^^^^^^^^^^^^^
5 | console.log('Hello from apollo:error hook! This is the Apollo Error Handler Plugin!')
6 | console.log('The error was:')
7 | console.log(error)
All I did was add plugins/apolloErrorHandler.ts with this content:
import { ErrorResponse } from '@nuxtjs/apollo'
export default defineNuxtPlugin(nuxtApp => {
nuxtApp.hook('apollo:error', (error: ErrorResponse) => {
console.log('Hello from apollo:error hook! This is the Apollo Error Handler Plugin!')
console.log('The error was:')
console.log(error)
})
})
Note: Everything else in Nuxt Apollo seems to be working fine except for this Error Hook.
Environment
Describe the bug
I wanted to use the Error Hook as described in the docs but I does not seem work and I am getting this error:
All I did was add
plugins/apolloErrorHandler.ts
with this content:Note: Everything else in Nuxt Apollo seems to be working fine except for this Error Hook.
Expected behaviour
I expected it to work as described in the docs
Reproduction
No response
Additional context
No response
Logs
No response