Invariant Violation 17
See original GitHub issueWe 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:
- Created 4 years ago
- Reactions:7
- Comments:12 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.What version of
apollo-client
? My guess is that this refers to theinvariant
ingetQueryWithPreviousResult
, judging just from the stack trace.An
invariant(condition, message)
function call is an assertion thatcondition
is truthy, which throws an exception at runtime (with the givenmessage
) 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 forinvariant(..., 17)
ornew InvariantError(17)
. If you examine the surrounding code in a bundle likeapollo-client/bundle.esm.js
, you will find a version of theinvariant
orInvariantError
with the original message intact. Alternatively, if you can reproduce the error in development, without settingprocess.env.NODE_ENV === "production"
, then the errors messages will be preserved.