Network error after first GraphQL request
See original GitHub issue-
I’m submitting a … [ ] bug report [ ] feature request [ ] question about the decisions made in the repository [*] question about how to use this project
-
Summary When I try to use the
apollo-link-scalars
as advised in the README I get following error after I try to do first GraphQL query:
Uncaught (in promise) Error: Network error: operation.getContext is not a function
at new ApolloError (bundle.esm.js:76)
at bundle.esm.js:1469
My apollo client setup is following:
const cache = new InMemoryCache()
const schemaDocument = loader('../common/schema.graphql')
const link = ApolloLink.from([
withScalars({
schema: buildASTSchema(schemaDocument),
typesMap: { DateTime: GraphQLDateTime }
}),
new HttpLink()
])
const client = new ApolloClient({
cache,
link
})
The error disappears when the apollo-scalars-link
is removed.
I’m have an application created by Create React App.
Let me know if there’s any other information I can provide, however this is all I know right now.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Handling operation errors - Apollo GraphQL Docs
When a network error occurs, Apollo Client adds it to the error.networkError field returned by your useQuery call (or whichever operation hook you...
Read more >Top GraphQL Errors and How to fix them
When there is a network error while trying to contact a GraphQL server, ... there is a possibility of a request containing an...
Read more >Network Error when initiating a query to my graphql API
Here's my client request : const client = new ApolloClient({ uri: 'https://my-app.herokuapp.com/', headers: { authorization: "Bearer API_KEY ...
Read more >Handling GraphQL errors like a champ with unions and ...
When GraphQL was gaining popularity, I remember a meme made of some ... time to first byte, slow network requests, and also logs...
Read more >Five Common Problems in GraphQL Apps (And How to Fix ...
One of the first things you realize when coding a GraphQL back-end ... we still have one initial database call to get the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works now. Thank you very much!!!
for more info, it was a silly mistake in the serialization process, which replaced the original operation with a new object with the serialized variables… but it lost the prototype in the process. That meant that the
getContext
function was not there anymore. 🤦♂