-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutation component in react native doesn't show errors returned by server #3336
Comments
Sorry for the trouble, please close this issue. The options in my ApolloClient() setup was set to ignore errors in mutation. |
@BalajiJagadeesan How did you solve this? I tried to set a default errorPolicy for mutations and still no errors. Which version of |
@deftomat Sorry for the delay. I have removed the default options for mutation. While initializing the Apollo client with cache, I passed default options to set policy for the query and mutation
Now I commented out the query and mutate
To capture graphQL errors, you need to treat them as runtime errors which can be defined by setting error policy to none (This is the default behavior, so don't send any flags in options). If you set it to errorpolicy:"all", it ignores query errors but captures network errors (According to my testing with the issue). Not entirely sure (needs clarification). Hope this helps. |
Thanks for your response. I've find out that my issue was casued by an Offline Link in AWS AppSync client which is based on Apollo Client. Your solution works for a base Apollo Client. |
I am also using the AWSAppSyncClient and I am having a similar issue where my mutations don't return any errors (or any data for that matter). Were you able to solve the issue with AWS Appsync? I'm banging my head on my laptop in frustration looking for a solution. |
Hello,
I'm using the new mutation component that is released recently with Apollo 2.0 and react native. I have a custom GraphQL API which servers some data, it throws apollo errors for not authorized, validation or type mismatches. I can't capture apollo errors using error variable in mutation component (network errors can be captured but not Apollo errors returned from mutation). I use the same approach for Query component and apollo errors can be captured.
Mutation:
Mutation component:
![image](https://user-images.githubusercontent.com/11597497/38891766-2470d728-423a-11e8-9dfa-03b99355af1a.png)
Intended outcome:
Some kind of Apollo error should be shown in Mutation component.
This is the outcome of the above mutation in GraphQL playground
I was trying to create a person entry.If successfully added to db, id will be returned or else some kind of Apollo error will be returned.
Actual outcome:
No Apollo error is shown in the component. It shows if there is any network error (randomly created by turning off network) but not Apollo errors inside the request.
Note: I use query component similar to this and I get the Apollo errors.
How to reproduce the issue:
Version
(Not using Apollo client 2.2.8 because of this issue: [Crash] Object.setPrototypeOf(_this, ApolloError.prototype) on 2.2.8 #3236)
The text was updated successfully, but these errors were encountered: