Apollo-client: Client 2.4.3 errors out when executing a query with a hot cache

Created on 23 Oct 2018  路  13Comments  路  Source: apollographql/apollo-client

When a query runs for a second time (for example navigating back to an already visited page) and there's data in the cache, QueryManager crashes.

The data is fetched through vue-apollo. It uses a watch query, the fetchPolicy is set to 'cache-and-network'.

Intended outcome:
Query runs and fills cache as usual

Actual outcome:
Execution errors out:

QueryManager.js?96af:414 Uncaught TypeError: Invalid property descriptor. Cannot both specify accessors and a value or writable attribute, #<Object>
    at Function.defineProperty (<anonymous>)
    at handleKey (cloneDeep.js?1e56:28)
    at Array.forEach (<anonymous>)
    at cloneDeepHelper (cloneDeep.js?1e56:30)
    at eval (cloneDeep.js?1e56:13)
    at Array.forEach (<anonymous>)
    at cloneDeepHelper (cloneDeep.js?1e56:12)
    at handleKey (cloneDeep.js?1e56:27)
    at Array.forEach (<anonymous>)
    at cloneDeepHelper (cloneDeep.js?1e56:30)

apollo-2 4 3-error

How to reproduce the issue:
Working on a jsfiddle

Versions
Fails with:

  System:
    OS: Windows 10
  Binaries:
    npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    apollo-client: ^2.4.3 => 2.4.3
    vue-apollo: ^3.0.0-beta.11 => 3.0.0-beta.25
    vue-cli-plugin-apollo: ^0.17.2 => 0.17.2

Works with:

  System:
    OS: Windows 10
  Binaries:
    npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    apollo-client: ^2.4.2 => 2.4.2
    vue-apollo: ^3.0.0-beta.11 => 3.0.0-beta.25
    vue-cli-plugin-apollo: ^0.17.2 => 0.17.2

Most helpful comment

@GlennMatthys No, this is a new problem, which I accidentally introduced when I replaced that fclone package yesterday: https://github.com/apollographql/apollo-client/commit/78e2ad89f950da2829f49c7876f968adb2bc1302. Fix coming soon!

All 13 comments

Add this line to your package.json to temporarily solve this.
"apollo-utilities": "1.0.20"

@GlennMatthys No, this is a new problem, which I accidentally introduced when I replaced that fclone package yesterday: https://github.com/apollographql/apollo-client/commit/78e2ad89f950da2829f49c7876f968adb2bc1302. Fix coming soon!

In case there wasn't a GitHub notification, you should be able to fix this by running

npm install apollo-utilities@latest

to get version 1.0.23.

@benjamn [email protected] still pulls in [email protected] as a nested dep, which I can override with yarn's resolutions, but even after I do that, queries work correctly but mutations still produce the same error.

In case there wasn't a GitHub notification, you should be able to fix this by running

npm install apollo-utilities@latest

to get version 1.0.23.

This fixed my problem, thanks!

Version 1.0.23 doesn't fix the issue in vue-cli, but forcing 1.0.21 works.

I just started getting the same error. Is Apollo-utilities@latest for server or client?

I can confirm that 1.0.23 doesn't fix all deepClone issues.
Besides, apollo-client package is sticked to explicit version of apollo-utilities, so it doesn't get 1.0.23 until its republished:

"apollo-utilities": "1.0.22"

@benjamn This issue should be reopened as it doesn't appear to be fixed yet.

This should now be fixed with [email protected] (just published).

Just tested with [email protected] and is working for me. THX...

Was this page helpful?
0 / 5 - 0 ratings