`value.toString` is not a function issue

Since December 5, we have received some reports 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 actively investigating. However, at this time, the affected version of Kaspersky’s software is still being shipped.

How This May Impact You

If an end user has Kaspersky installed on their computer, they may experience the above error when visiting a website if the UI was built using Apollo Client, creating the false impression of a bug in Apollo Client. This can disrupt user experiences and lead to confusion among developers and end-users.

Recommended Action

To prevent this issue, we strongly recommend any of the following options:

  1. Upgrading your Apollo Client to version 3.11.8 or later. This version includes adjustments that mitigate the impact of the Kaspersky bug.
  2. Locally backporting the changes made in 3.11.8 using patch-package. Here is an example patch for Apollo Client 3.7.17: @apollo+client+3.7.17.patch
  3. By providing a custom fetch function to HttpLink that replaces the headers before they hit the Kaspersky extension.
new ApolloClient({
  cache: new InMemoryCache({
  /*...*/
  }),
  link: new HttpLink({
    uri: "...",
    fetch: (input, init) => {
      if (!init || !init.headers) {
        return fetch(input, init);
      }
      return fetch(input, {
        ...init,
        headers: { ...headers },
      });
    },
  }),
});

Any of these mitigation techniques will help ensure a seamless experience for end users while Kaspersky works on resolving the issue.

We are closely monitoring this situation and will provide updates to this post as Kaspersky makes progress on resolving the bug. In the meantime, if you experience any related issues after upgrading to Apollo Client 3.11.8 or later, please don’t hesitate to open an issue in our GitHub repo.

Status update: a Kaspersky team member indicated in this forum post that a fix in their software is on its way in a release slated for late January / early February 2025.