Some of our users are seeing the exception “ApolloError: value.toString is not a function” from a useQuery hook on one of our GraphQL queries. We haven’t been able to reproduce the error. Do you have any idea what might cause this or how we can prevent it?
Please note that userland code e.g. inside a custom ApolloLink that throws an error, and even browser plugins that hook into fetch and throw an error for some reason would still end up as an ApolloError, so it’s very possible that this originates outside of Apollo Client.
Unfortunately that’s only the stacktrace of ApolloError, which wraps around the original error which is thrown waaaay sooner to bring it into a predictable format.
Is there any chance you can access error.cause and look at the stack trace of that?
Scratch that, in your version error.cause probably doesn’t exist yet. You’d have to look at error.networkError, error.graphQLErrors, error.protocolErrors and error.clientErrors to find the possible original error.
We are experiencing the same problem and found that it is related to some code coming from kaspersky anti-virus.
The stack trace lead us to some function called copyHeaders() on Kaspersky side that proxies the native fetch() function.
It happens only with requests using apollo client.
We encountered something similar with a Safari extension before, and made changes on our side that should make this less likely to happen - if you can, please try to update to Release v3.11.8 · apollographql/apollo-client · GitHub
@NitzanSirota as you reported in the other thread that you are updating, please keep me posted if the update really resolves the issue. I’m still trying to reproduce the problem on my end.
I’ve opened an issue in the Apollo Client repo as well for us to track and provide communications. Feel free to follow that thread if you’re interested in updates.