"Out of stack space" error
See original GitHub issueIntended outcome:
In our application, we are using Apollo Client, and are doing some manual queries (i.e. not attached to a component). I would expect that it works on IE11 like it works everywhere else.
Actual outcome:
On IE11, we get an “Out of stack space” error thrown in IE11. This only happens when we make Apollo Client queries. When we comment out our graphql queries, our application works fine on IE11.
The weird thing is this error only occurs when Google Maps is included. When we remove Google Maps, everything works great. … I know, right?!
How to reproduce the issue:
I have boiled it down to a small reproducible example. To reproduce:
git clone https://github.com/lehresman/apollo-client-ie11-example.git
cd apollo-client-ie11-example
yarn install
node server.js
Then visit http://localhost:3001 in IE11
Edit www/index.html
and remove the Google Maps <script>
tag and you’ll see everything works fine.
Version
- apollo-client@2.2.5
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:13 (8 by maintainers)
Top GitHub Comments
We looked through the issue with @valstu and the issue is there seems to be rather complex (or at least sounds silly, but hear me out 😂):
The failing piece of code is
https://github.com/apollographql/apollo-client/blob/6eec674f206cda11cf667a89022354b1476f5503/packages/apollo-client/src/core/QueryManager.ts#L588-L596
which calls
deepFreeze
similar tosubstack/deep-freeze
inapollo-utilities
:https://github.com/apollographql/apollo-client/blob/a32f31d79806a29cd2a9f6211d64c92997d5408a/packages/apollo-utilities/src/util/maybeDeepFreeze.ts#L3-L18
Okay, now the silly part: when Google updated
Google Maps
to version3.30
I’d assume they updated their version of Closure Compiler too. The reason why everything fails is thatObject.getOwnPropertyNames(o)
suddenly has theSymbol
polyfill keys in them:(jscomp_symbol is the Symbol polyfill of Closure Compiler, right?)
… which ends up in endless loop on IE11 and eventually crashes the browser. I’d think the issue might be related to https://github.com/google/closure-compiler/issues/2448
Using different
deepFreeze
doesn’t help either, we trieddeep-freeze-strict
andjs-flock
first to check if some other deepFreeze implementation wouldn’t have the same problem but obviously enumerating theownProperties
rely on the same things.(Downgrading to Google Maps v3.29 isn’t an option either anymore as they retired it, so there’s that too.).
I don’t know if there’s any other short term solution to not
deepFreeze
them, but that has its own downsides. On the other hand this should only occur on non-production version IE11, which only affect one if they are trying to debug Google Maps issues on IE11 (like we have done for like 5 working days now…).Also: https://twitter.com/pete_tnt/status/940987922664312832
Fixed by https://github.com/apollographql/apollo-client/pull/3082 (thanks @petetnt!).