Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: 16 #5730

Closed
developdeez opened this issue Dec 27, 2019 · 7 comments
Closed

Invariant Violation: 16 #5730

developdeez opened this issue Dec 27, 2019 · 7 comments

Comments

@developdeez
Copy link

Not much data on these types of error. Not sure why they keep happening.

@brentguistwite
Copy link

@developdeez I'm assuming you're using react hooks(useQuery, useMutation)? I've run into this before and it was due to having conflicting versions of react and/or react-dom. I was important a component which used useQuery from a library but the package I was working in had a different version of React. Pinning the versions fixed it for me.

@IAmBrandonMcGregor
Copy link

I'm seeing this error reported via through our Sentry instance. We're not using React. Instead, we're using the Apollo Client directly. Our versions are…

"apollo-cache-inmemory": "^1.6.3",
"apollo-client": "^2.6.4",
"apollo-link": "^1.2.13",
"apollo-link-context": "^1.0.19",
"apollo-link-error": "^1.1.12",
"apollo-link-http": "^1.5.16",
"apollo-link-ws": "^1.0.19",
"apollo-utilities": "^1.3.2",

@IAmBrandonMcGregor
Copy link

Bumped our libs and still seeing this issue.

From our package.json

"apollo-cache-inmemory": "^1.6.5",
"apollo-client": "^2.6.8",
"apollo-link": "^1.2.13",
"apollo-link-context": "^1.0.19",
"apollo-link-error": "^1.1.12",
"apollo-link-http": "^1.5.16",
"apollo-link-ws": "^1.0.19",
"apollo-utilities": "^1.3.3",

Error Details

Invariant Violation: Invariant Violation: 16 (see https://github.com/apollographql/invariant-packages)
  at new n(../../node_modules/ts-invariant/lib/invariant.esm.js:12:28)
  at ? (../../node_modules/apollo-client/bundle.esm.js:1420:60)
  at Map.forEach(<anonymous>)
  at clearStore(../../node_modules/apollo-client/bundle.esm.js:1419:34)
  at ? (../../node_modules/apollo-client/bundle.esm.js:2058:59)

@mcclowes
Copy link

mcclowes commented May 4, 2020

Also seeing this. Not using apollo-client, and have checked the versions of react/react-dom are consistent

@ivan-kleshnin
Copy link

ivan-kleshnin commented Jul 18, 2020

Invariant Violation: 47 rarely but systematically occurs since update to the latest apollo (3.1.0)
No error details to add, empty stack 😞
(using @apollo/client only, no react-apollo, etc).

benjamn added a commit that referenced this issue Jul 21, 2020
When an invariant fails in production, a cryptic numeric error of the form
`Invariant Violation: 42` is thrown, with a reference to the error codes
section of invariant-packages README.md: https://github.com/apollographql/invariant-packages#error-codes

This vague guidance has not proven adequate in many cases, to say the
least: see apollographql/invariant-packages#18,
apollographql/invariant-packages#19, #6604,

However, this vague guidance (which was intended to suggest searching
your installed node_modules/@apollo/client package for the error code)
has not proven adequate in many cases, to say the least: see apollographql/invariant-packages#18,
apollographql/invariant-packages#19, #6604, #5730, #5291, and #5975,
to cite just a few of the many issues we've seen since #4521.

Using error codes instead of error strings remains important for
production bundle sizes, but I think we can make it substantially easier
to look up the error string corresponding to each error code, by
generating a single file containing all the invariant error codes for each
@apollo/client release.

Starting with Apollo Client 3.1.0, this manifest file can be found in
@apollo/client/invariantErrorCodes.js (using an npm/yarn-installed copy of
@apollo/client, since this file is generated in the ./dist directory, not
checked into the repository). The file contains an explanatory comment,
the @apollo/client version, and a sequential map from error numbers to the
{ file, node } responsible for the error.
jimrandomh pushed a commit to jimrandomh/apollo-client that referenced this issue Jul 22, 2020
…llographql#6665)

When an invariant fails in production, a cryptic numeric error of the form
`Invariant Violation: 42` is thrown, with a reference to the error codes
section of invariant-packages README.md: https://github.com/apollographql/invariant-packages#error-codes

This vague guidance has not proven adequate in many cases, to say the
least: see apollographql/invariant-packages#18,
apollographql/invariant-packages#19, apollographql#6604,

However, this vague guidance (which was intended to suggest searching
your installed node_modules/@apollo/client package for the error code)
has not proven adequate in many cases, to say the least: see apollographql/invariant-packages#18,
apollographql/invariant-packages#19, apollographql#6604, apollographql#5730, apollographql#5291, and apollographql#5975,
to cite just a few of the many issues we've seen since apollographql#4521.

Using error codes instead of error strings remains important for
production bundle sizes, but I think we can make it substantially easier
to look up the error string corresponding to each error code, by
generating a single file containing all the invariant error codes for each
@apollo/client release.

Starting with Apollo Client 3.1.0, this manifest file can be found in
@apollo/client/invariantErrorCodes.js (using an npm/yarn-installed copy of
@apollo/client, since this file is generated in the ./dist directory, not
checked into the repository). The file contains an explanatory comment,
the @apollo/client version, and a sequential map from error numbers to the
{ file, node } responsible for the error.
@punksta
Copy link

punksta commented Sep 15, 2020

having Invariant Violation: 20 (see https://github.com/apollographql/invariant-packages) in clearStore.

@apollo/client:3.1.3

@hwillson
Copy link
Member

#6665 was merged to help with troubleshooting errors like this. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants