-
Notifications
You must be signed in to change notification settings - Fork 30
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
Continuous crashes on React Native Android #382
Comments
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? |
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. |
Alright, I'm able to reproduce this one! Not sure exactly what's going on, yet. Here's what I know so far:
|
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 |
Aha! Nope, it is getting into Hermes' read call, somewhat. I've narrowed it down to this loop:
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 |
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... |
Aha, nope, it's a RN packager issue: facebook/react-native#4676 |
Alright! @alexanderson1993, the fix for your situation is to add the following to 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 I'm going to see if I can have Hermes detect this case and throw a helpful error… |
This is fabulous! Many thanks! |
Thanks @nevir it worked like a charm |
Summary: I'm using React Native and Expo to create an app which connects to a GraphQL server using Apollo. I was using apollo-cache-hermes, but it continually crashed the application as soon as the first GraphQL query was made. It took me a while to track down apollo-cache-hermes as the culprit, but once I did I replaced it with apollo-cache-inmemory and the app worked as expected. This behavior was repeated on two Android emulators (Android Studio and Genymotion) and an Android device.
Incidentally, it runs perfectly on iOS.
Reproduction Steps:
Link to a demo repo: https://github.com/alexanderson1993/apollo-cache-hermes-crash
Link to an expo application: https://expo.io/@alexanderson1993/apollo-cache-hermes-crash
Expected Behavior:
Retrieve data through Apollo when GraphQL queries are performed.
Actual Behavior:
The app crashes whenever a GraphQL query is made.
The text was updated successfully, but these errors were encountered: