apollo
apollo copied to clipboard
Error: Invalid AST Node: null. - NUXT3
Environment
"@nuxtjs/apollo": "^5.0.0-alpha.8",
Describe the bug
Sometimes I get randomly this error when trying to call graphql method.
I have a composable function
export async function GQL_REQUEST(query) {
try {
const { data, refresh, error } = useAsyncQuery(query)
if (!data.value) {
//on alpha.5 bug fixing, forse puoi rimuovere appena passa a beta/stable
return refresh()
.then(() => {
return JSON.parse(JSON.stringify(data.value))
})
.catch((err) => {
log('////////GRAPHQL ERROR REFRESH METHOD', true)
log(query.loc.source)
log(err)
})
} else {
return data.value
}
} catch (err) {
log('////////GRAPHQL ERROR AT INIT', true)
log(err)
}
}
this is the error in console
Error: Invalid AST Node: null.
at devAssert (devAssert.mjs:5:11)
at visit (visitor.mjs:168:23)
at print (printer.mjs:10:10)
at prep (composables.mjs?v=03ae6653:24:47)
at useAsyncQuery (composables.mjs?v=03ae6653:7:23)
at GQL_REQUEST (gqlRequest.js:3:38)
at Proxy.getDocumentByTipoUd (index.js:134:20)
at Proxy.
Expected behaviour
query works
Reproduction
No response
Additional context
No response
Logs
No response
Could you provide a complete example of how to reproduce this issue? The example you mentioned does not seem to be complete, as e.g. the query
is not specified and could possibly be the cause.