Giter Site home page Giter Site logo

Comments (11)

nevir avatar nevir commented on July 30, 2024 2

Alright! @alexanderson1993, the fix for your situation is to add the following to index.js:

import 'core-js/es6/symbol';
import 'core-js/es6/set';
import 'core-js/es6/map';

The root cause here is that RN fails to correctly polyfill Symbol in the Android environment (the issue linked above). So, we explicitly load that polyfill, and also Set/Map for good measure, as Hermes also relies on those.


I'm going to see if I can have Hermes detect this case and throw a helpful error…

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024 1

Aha, nope, it's a RN packager issue: facebook/react-native#4676

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

I'm sorry for the delay on this issue. Working on getting my machine set up for android again (I've gone and goofed my SDK/NDK somewhere)

In the meantime, do you have a stack trace handy—or remember what error was being thrown?

from apollo-cache-hermes.

alexanderson1993 avatar alexanderson1993 commented on July 30, 2024

I'm afraid I'm not technically savvy enough to be able to pull up a stack trace or even the error thrown. The app crashed immediately after the request was made, and I was only able to track down apollo-cache-hermes as the culprit after a lot of trial and error.

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

Alright, I'm able to reproduce this one! Not sure exactly what's going on, yet. Here's what I know so far:

  • The app is running out of memory and being killed by the OS
  • It occurs before apollo client even initiates the network request (the configured apollo link is not called)
  • None of Hermes' verbose logging triggers before the OOM occurs

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

Actually, interestingly, the OOM occurs sometime before Hermes' query interface is called.

I have a hunch that it's similar to zloirock/core-js#368, but can't prove that yet

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

Aha! Nope, it is getting into Hermes' read call, somewhat. I've narrowed it down to this loop:

for (const name of this.variables) {

It iterates forever for your query (when consuming an empty set), emitting undefined until OOM. Might be a tslib bug, or we might be passing unexpected data to it

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

Oof, it may be a tslib bug. Just filed microsoft/tslib#59 to get some more eyes on it. Might also be that react-native android is incorrectly polyfilling Set/Map...

from apollo-cache-hermes.

alexanderson1993 avatar alexanderson1993 commented on July 30, 2024

This is fabulous! Many thanks!

from apollo-cache-hermes.

nevir avatar nevir commented on July 30, 2024

Hopefully this error helps people from having to go down this rabbit hole again:

screenshot_1541175368

from apollo-cache-hermes.

zasyadev avatar zasyadev commented on July 30, 2024

Alright! @alexanderson1993, the fix for your situation is to add the following to index.js:

import 'core-js/es6/symbol';
import 'core-js/es6/set';
import 'core-js/es6/map';

The root cause here is that RN fails to correctly polyfill Symbol in the Android environment (the issue linked above). So, we explicitly load that polyfill, and also Set/Map for good measure, as Hermes also relies on those.

I'm going to see if I can have Hermes detect this case and throw a helpful error…

Thanks @nevir it worked like a charm

from apollo-cache-hermes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.