Open spaceninja opened 7 months ago
Darwin
v21.7.1
3.11.1
2.9.5
npm@10.5.0
-
I'm using a custom fetch function in httpLinkOptions as detailed here: https://www.apollographql.com/docs/react/api/link/apollo-link-http/#customizing-fetch
httpLinkOptions
// nuxt.config.ts: import apolloConfig from './apollo-config'; export default defineNuxtConfig({ apollo: apolloConfig, modules: ['@nuxtjs/apollo'], });
// apollo-config.ts import fetch from 'isomorphic-fetch'; export default { clients: { default: { httpEndpoint: process.env.NUXT_DATOCMS_GRAPHQL_URL, httpLinkOptions: { headers: { Authorization: `Bearer ${process.env.NUXT_DATOCMS_TOKEN}`, }, fetch: (uri: string, options: any) => { const fetchBody = JSON.parse(options.body); // do some stuff to modify fetchBody options.body = JSON.stringify(fetchBody); return fetch(uri, options); }, }, }, }, };
// example.vue import sampleQuery from 'sample.gql'; const { data: sampleData, pending: sampleLoading, error: sampleError, } = useAsyncQuery(sampleQuery);
With this example, sampleError comes back with "_isomorphicFetch is not defined"
After a bit of digging, this is the NetworkError field on the error returned by Apollo: https://www.apollographql.com/docs/react/api/link/apollo-link-error#networkerror
I don't get any console or server errors.
No response
Environment
Darwin
v21.7.1
3.11.1
3.11.1
2.9.5
npm@10.5.0
-
-
-
-
Describe the bug
I'm using a custom fetch function in
httpLinkOptions
as detailed here: https://www.apollographql.com/docs/react/api/link/apollo-link-http/#customizing-fetchExpected behaviour
With this example, sampleError comes back with "_isomorphicFetch is not defined"
After a bit of digging, this is the NetworkError field on the error returned by Apollo: https://www.apollographql.com/docs/react/api/link/apollo-link-error#networkerror
I don't get any console or server errors.
Reproduction
No response
Additional context
No response
Logs
No response