# ApolloError: value.toString is not a function

**URL:** <https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972>\
**Category:** Client SDKs\
**Tags:** client\
**Created:** [December 5, 2024, 5:28am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972 "2024-12-05T05:28:02Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 5, 2024, 5:28am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/1 "2024-12-05T05:28:02Z")

</div>

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?

We are on Apollo 3.9.10

---

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 5, 2024, 5:34am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/2 "2024-12-05T05:34:11Z")

</div>

One common feature is that so far all the affected users seem to be on Windows \>= 10

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 5, 2024, 8:46am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/3 "2024-12-05T08:46:10Z")

</div>

Is there any stack trace attached?

I’ve looked at the AC sources and I don’t believe that this originates in our codebase - the only method call this could occur is here:

> <https://github.com/apollographql/apollo-client/blob/d42d9e09f6e887d2e862784eb601a8bda5802f11/src/utilities/common/makeUniqueId.ts#L8>

But `Number.prototype.toString()` is supported pretty much by every browser in history, ever: [Number.prototype.toString() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString#browser_compatibility)

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.

Do you have a full stack trace for this?

---

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 5, 2024, 10:50pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/4 "2024-12-05T22:50:47Z")

</div>

![Screenshot 2024-12-06 at 9.50.24 am](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/e/ea42a8ca7eabdcf599dc6393ac7f8864e3facb4b.png)

---

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 5, 2024, 10:54pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/5 "2024-12-05T22:54:14Z")

</div>

There is a second set with the same error from a different source in our app. Both go through QueryManager.js:

 ![Screenshot 2024-12-06 at 9.53.11 am](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/0/0ccd47a90d14448db41211370ee548c6df5b572a.png)

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 6, 2024, 9:22am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/6 "2024-12-06T09:22:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 6, 2024, 9:24am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/7 "2024-12-06T09:24:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NitzanSirota](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nitzansirota/32/5398_2.png) [@NitzanSirota](https://community.apollographql.com/u/NitzanSirota)\
**Post date:** [December 8, 2024, 1:49pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/8 "2024-12-08T13:49:23Z")

</div>

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.

Stacktrace:  
"TypeError: value.toString is not a function\n at CopyHeadersValue ([https://gc.kis.v2.scr.kaspersky-labs.com/FD126C42-EBFA-4E12-B309-BB3FDD723AC1/main.js?attr=fVzR6GWpTiGSWVNM\_NZXCRQJPJp1YS83KyHeXrNEYHrQcGytgDBRQf\_T4qtafYO\_Naziog3E0EyHZxlIGcm0MLu9Fr9KBOeT6jziCBmpYyVCYk2\_9sSSSNRBFLcbAlfU-1Cemzd9G8W-5q0a1FQt93BzjfgeI9I3JQLlMpPW7Af68xjJ8PD9XB4naOIJ2EXPuQ2Cq8YQIlPndkWTkJNbeQ:3742:15](https://gc.kis.v2.scr.kaspersky-labs.com/FD126C42-EBFA-4E12-B309-BB3FDD723AC1/main.js?attr=fVzR6GWpTiGSWVNM_NZXCRQJPJp1YS83KyHeXrNEYHrQcGytgDBRQf_T4qtafYO_Naziog3E0EyHZxlIGcm0MLu9Fr9KBOeT6jziCBmpYyVCYk2_9sSSSNRBFLcbAlfU-1Cemzd9G8W-5q0a1FQt93BzjfgeI9I3JQLlMpPW7Af68xjJ8PD9XB4naOIJ2EXPuQ2Cq8YQIlPndkWTkJNbeQ:3742:15))\n

---

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 8, 2024, 10:19pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/9 "2024-12-08T22:19:38Z")

</div>

Yes, I discovered that this morning. There’s a conversation happening over in the Kaspersky forums. Thanks for your help Lenz and Nitzan.

> **[Kaspersky is breaking ApolloClient requests(GraphQL)](https://forum.kaspersky.com/topic/kaspersky-is-breaking-apolloclient-requestsgraphql-52752/)**
>
> Not sure this is the right forum, please redirect to the relevant one if there is one. We are getting complaints from our users that their site is not working. Looking into it, we found out that the exception is being thrown from Kaspersky code, a...

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 9, 2024, 8:56am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/10 "2024-12-09T08:56:45Z")

</div>

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](https://github.com/apollographql/apollo-client/releases/tag/v3.11.8)

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 9, 2024, 2:57pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/11 "2024-12-09T14:57:31Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![jerelmiller](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jerelmiller/32/3314_2.png) [@jerelmiller](https://community.apollographql.com/u/jerelmiller)\
**Post date:** [December 9, 2024, 7:15pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/12 "2024-12-09T19:15:56Z")

</div>

I’ve opened an [issue](https://github.com/apollographql/apollo-client/issues/12202) 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.

---

<div class="post-metadata">

**Author:** ![NitzanSirota](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nitzansirota/32/5398_2.png) [@NitzanSirota](https://community.apollographql.com/u/NitzanSirota)\
**Post date:** [December 10, 2024, 8:00am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/13 "2024-12-10T08:00:22Z")

</div>

I’m working on checking newer version of apollo on one of our machines, I’ll update in about 1 hour

---

<div class="post-metadata">

**Author:** ![NitzanSirota](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nitzansirota/32/5398_2.png) [@NitzanSirota](https://community.apollographql.com/u/NitzanSirota)\
**Post date:** [December 10, 2024, 11:45am UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/14 "2024-12-10T11:45:27Z")

</div>

Sorry for not updating, we have internal problems. Trying to get to it ASAP

---

<div class="post-metadata">

**Author:** ![NitzanSirota](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/nitzansirota/32/5398_2.png) [@NitzanSirota](https://community.apollographql.com/u/NitzanSirota)\
**Post date:** [December 10, 2024, 3:22pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/15 "2024-12-10T15:22:34Z")

</div>

hey, sorry it took so long, but we can verify newer version of apollo works 🙂

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [December 10, 2024, 3:34pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/16 "2024-12-10T15:34:36Z")

</div>

That’s great to hear @NitzanSirota ! 🙂

---

<div class="post-metadata">

**Author:** ![jerelmiller](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jerelmiller/32/3314_2.png) [@jerelmiller](https://community.apollographql.com/u/jerelmiller)\
**Post date:** [December 10, 2024, 11:03pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/17 "2024-12-10T23:03:48Z")

</div>

FYI, we have opened a new community thread where we will post updates as we have them. Thanks!

> [@\`value.toString\` is not a function issue](https://community.apollographql.com/t/value-tostring-is-not-a-function-issue/7992):
>
> Since December 5, we have received some [reports](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/13) from Apollo Client users encountering an ApolloError with the message: value.toString is not a function. After thorough investigation, we determined that this issue is not caused by Apollo Client but stems from a bug in certain Kaspersky products. Specifically, this bug interferes with Apollo Client’s functionality when users visit websites utilizing Apollo Client versions older than 3.11.8. We have informed Kaspersky of this issue, and they are …

---

<div class="post-metadata">

**Author:** ![macosgrove](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/macosgrove/32/5391_2.png) [@macosgrove](https://community.apollographql.com/u/macosgrove)\
**Post date:** [December 16, 2024, 10:34pm UTC](https://community.apollographql.com/t/apolloerror-value-tostring-is-not-a-function/7972/18 "2024-12-16T22:34:57Z")

</div>

We updated our App to 3.11.8 a while ago and have had no issues since. Thanks for your work on this.
