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

undefined is not a function in nodejsCustomInspectSymbol #2007

Closed
jaynetics opened this issue Jul 2, 2019 · 2 comments · Fixed by #2009
Closed

undefined is not a function in nodejsCustomInspectSymbol #2007

jaynetics opened this issue Jul 2, 2019 · 2 comments · Fixed by #2009

Comments

@jaynetics
Copy link
Contributor

is it feasible to add another check, typeof Symbol.for === 'function' to nodejsCustomInspectSymbol?

we get some cases of TypeError: undefined is not a function originating from https://github.com/graphql/graphql-js/blob/master/src/jsutils/nodejsCustomInspectSymbol.js#L5

in other words: there are cases were Symbol is a function, but Symbol.for is undefined :~(

unfortunately i have no idea how this can happen and no idea how to reproduce. we use core-js and no other polyfills.

interestingly, the bug only occurs exclusively in a few user agents:

  • Chrome 74.0.3729.169
  • Chrome 74.0.3729.157
  • Samsung Browser 9.2

if you don't want to add another check, i'll investigate further. this might be a bug or conflict related to core-js...

@IvanGoncharov
Copy link
Member

if you don't want to add another check, i'll investigate further. this might be a bug or conflict related to core-js...

@jaynetics Proposed check doesn't add too much complexity so I don't have a problem merging it if Symbol.for is really missing in some environments.
That said I think it's important to understand the root cause of this issue and document it in the source code.
Can you please investigate root cause?

@jaynetics
Copy link
Contributor Author

@IvanGoncharov

i went to some lengths to install outdated chromes in VMs and could not reproduce the issue.

my random guess is that some browser plugin undefines Symbol.for for these users.

either way, i found that all browsers happily allow modifying Symbol.for, as in Symbol.for = undefined, so i think an extra check can't hurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants