question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Object(...) is not a function in depTrackingCache.js when Upgrading from 1.2.10 to 1.3.0

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:22 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
microcipcipcommented, Dec 24, 2018

Stuck with this error as well, I have no idea how to fix it 😦. I am using TS with next and react-apollo.

1reaction
markfrancocommented, Dec 1, 2018

On line 1 in the optimism.js in apollo-cache-inmemory node_modules folder I replaced this line var wrap = require('optimism').wrap; with import { 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
Backbone.js
The function is passed the raw response object, and should return the attributes hash to be set on the model. The default implementation...
Read more >
AngularJS TypeError: object is not a function
I've tried upgrading to Angular 1.2.15 and I get the same error. And unstable version 1.3.0-beta.4 same result. Cause: For some reason ...
Read more >
CoffeeScript
The JavaScript arguments object is a useful way to work with functions that accept variable numbers of arguments. CoffeeScript provides splats ... ,...
Read more >
Uncaught TypeError: object is not a function on "(function($)"
Javascript ignore missing semi-colon and try to interpret it. So if you don't input the semi-colon, it use the next line to see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found