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.

Invariant Violation 17

See original GitHub issue

We have this issue that we detect only on Sentry side. Hence I never encountered it myself during development so I have no idea how to reproduce but here is the error message:

Invariant Violation: Invariant Violation: 17 (see https://github.com/apollographql/invariant-packages)
  at new t (/static/js/20.3c6f5529.chunk.js:1:129014)
  at s (/static/js/20.3c6f5529.chunk.js:1:129219)
  at e.getQueryWithPreviousResult (/static/js/20.3c6f5529.chunk.js:1:525535)
  at t.updateQuery (/static/js/20.3c6f5529.chunk.js:1:502730)
  at None (/static/js/20.3c6f5529.chunk.js:1:501301)

Additional data that sentry provides are:

{
framesToPop: 1
}

Any googling around that didn’t help me find what can be the cause of that, but I’ll be happy if anyone can give me any idea about this one.

The only clue is that it happens when the user leaves the page with one particular Query out to any different route that unmounts component that uses such query. And it always the same one.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

28reactions
benjamncommented, Sep 10, 2019

What exact versions of the apollo-* packages are you using? It’s relatively straightforward to track down a specific invariant number given the published bundle, as explained in the README mentioned in the error message you pasted above.

17reactions
benjamncommented, Sep 12, 2019

What version of apollo-client? My guess is that this refers to the invariant ingetQueryWithPreviousResult, judging just from the stack trace.

An invariant(condition, message) function call is an assertion that condition is truthy, which throws an exception at runtime (with the given message) if the condition is falsy. The nice thing about the http://npmjs.org/package/ts-invariant package is that we can strip long messages in the production build, which saves more bundle size than any other optimization (besides minification and gzip, of course). In production bundles, the messages are replaced with unique numbers (e.g. 17), which you can find in the production bundle by looking for invariant(..., 17) or new InvariantError(17). If you examine the surrounding code in a bundle like apollo-client/bundle.esm.js, you will find a version of the invariant or InvariantError with the original message intact. Alternatively, if you can reproduce the error in development, without setting process.env.NODE_ENV === "production", then the errors messages will be preserved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javier Cuevas on Twitter: "Invariant Violation 17 is still ...
The first error we faced was "Invariant Violation 16" [1]. These error happens when calling apolloClient.resetStore() where there are still queries in flight...
Read more >
Getting "Invariant Violation" error with Apollo GraphQL
First of all, it appears that Apollo is being started in "production mode" rather than "developpement mode". By starting it in development ...
Read more >
Demostrating error "Invariant Violation - CodeSandbox
Demostrating error "Invariant Violation: Could not find "client" in the context of ApolloConsumer. Wrap the root component in an <ApolloProvider>".
Read more >
invariant | Yarn - Package Manager
env.NODE_ENV . 2.2.0 / 2015-11-17. Use error.name instead of Invariant Violation . 2.1.3 / 2015-11-17. Remove @provideModule pragma. 2.1.2 / 2015-10-27. Fix ...
Read more >
Combining Invariant Violation with Execution Path ...
fying invariant violations and their corresponding ... invariant violation based on the size and com- plexity of the code traversed by ... 17(12):1284–1288....
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