You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
Intended outcome: Logging graphQLError messages to the console
[edit] It seems that on specifically [Network error]: Error: 400 (Bad Request) I don't receive the graphQLErrors but in other cases I do get the expected errors.
Error messages returned from failed queries never seem to make it to onError() as graphQLErrors is always undefined, but I'm always given a networkError. I can find the failed request with the response error messages in chrome's network tab. Am I missing something?
// Log errorsconsterrorLink=onError(({ graphQLErrors, networkError })=>{if(graphQLErrors)graphQLErrors.map(({ message, locations, path })=>console.log(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`));if(networkError)console.log(`[Network error]: ${networkError}`);});// Combine all linksconstlink=split(// split based on operation type: subscription or query/mutation({ query })=>{const{ kind, operation }=getMainDefinition(query);returnkind==='OperationDefinition'&&operation==='subscription';},// Subscriptions Linkfrom([// Log Apollo operations in development
...(__DEV__ ? [apolloLogger] : []),// Handle subscriptions, log errors in dev
...(__DEV__ ? [errorLink.concat(subscriptionsLink)] : [subscriptionsLink]),]),// Uploads/http Linkfrom([// Log Apollo operations in development
...(__DEV__ ? [apolloLogger] : []),// Handle http/file uploads, log errors in dev
...(__DEV__ ? [errorLink.concat(uploadLink)] : [uploadLink]),]),);
The text was updated successfully, but these errors were encountered:
Does the error policy on a per-query basis somehow impact how onError() gets it's messages? Or maybe there are some new params to GraphQL-Tools/Apollo Server to enable error logging?
@tim-soft is it possible the fetch library that you're using is treating HTTP 400 status as a network error? I've come across a few fetch modules like that.
Intended outcome: Logging graphQLError messages to the console
[edit] It seems that on specifically
[Network error]: Error: 400 (Bad Request)
I don't receive the graphQLErrors but in other cases I do get the expected errors.Error messages returned from failed queries never seem to make it to
onError()
asgraphQLErrors
is always undefined, but I'm always given a networkError. I can find the failed request with the response error messages in chrome's network tab. Am I missing something?The text was updated successfully, but these errors were encountered: