apollo-client: TypeError: Object(...) is not a function in depTrackingCache.js when Upgrading from 1.2.10 to 1.3.0
Intended outcome: Upgrading from apollo-cache-inmemory ^1.2.10 to 1.3.0 Intend no issues in consuming code Actual outcome: Stack trace in browser
in /node_modules/apollo-cache-inmemory/lib/depTrackingCache.js:8
this.depend = wrap(function (dataId) { return _this.data[dataId]; }, {
defaultNormalizedCacheFactory
return new DepTrackingCache(seed);
/node_modules/apollo-cache-inmemory/lib/depTrackingCache.js:60
How to reproduce the issue:
Consumer code (unchanged) (originaly from React Starter Kit)
// https://www.apollographql.com/docs/react/basics/caching.html#configuration
return new InMemoryCache({
dataIdFromObject,
});
}
Versions
System: OS: Windows 10 Binaries: Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 5.7.1 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: 42.17134.1.0 npmPackages: apollo-cache-inmemory: 1.3.0 => 1.3.0 apollo-client: 2.4.2 => 2.4.2 apollo-link: ^1.0.7 => 1.2.1 apollo-link-error: ^1.0.3 => 1.0.7 apollo-link-http: ^1.3.2 => 1.5.3 apollo-link-logger: ^1.1.0 => 1.2.0 apollo-link-schema: ^1.0.1 => 1.0.6 react-apollo: 2.1 => 2.1.9
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 22 (3 by maintainers)
Stuck with this error as well, I have no idea how to fix it 😦. I am using TS with next and react-apollo.
On line 1 in the optimism.js in apollo-cache-inmemory node_modules folder I replaced this line
var wrap = require('optimism').wrap;
withimport { wrap } from 'optimism/lib'
.And now my app has started working again.
I guess this is a workaround for now, and I’m still trying to investigate why this is happening.