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

Release builds of app immediately crash at runtime #337

Closed
3 of 5 tasks
chrisshiplet opened this issue Jan 23, 2018 · 5 comments
Closed
3 of 5 tasks

Release builds of app immediately crash at runtime #337

chrisshiplet opened this issue Jan 23, 2018 · 5 comments
Assignees

Comments

@chrisshiplet
Copy link

chrisshiplet commented Jan 23, 2018

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

v8.1.2
5.5.1
MyApp@0.0.1 /Users/chris/apps/myapp/MyApp
├── @redux-offline/redux-offline@2.2.1
├── @synapsestudios/fetch-client@1.0.3
├── async@2.6.0
├── date-fns@1.29.0
├── formik@0.10.5
├── immutable@3.8.2
├── jwt-decode@2.2.0
├── lodash@4.17.4
├── querystring@0.2.0
├── react@16.2.0
├── react-native@0.52.0
├── react-native-modal@4.1.1
├── react-native-sentry@0.32.1
├── react-native-sqlite-2@1.5.2
├── react-native-svg@5.5.1
├── react-navigation@1.0.0-beta.23
├── react-redux@5.0.6
├── redux@3.7.2
├── redux-persist-transform-immutable@4.3.0
├── redux-thunk@2.2.0
├── reselect@3.0.1
├── url-search-params-polyfill@2.0.2
└── uuid@3.2.1

Config:

Platform.select({"ios":"https://REDACTED@sentry.io/272016","android":"https://REDACTED@sentry.io/272016"});

I have following issue:

When I build an iOS or Android release build of my app, the app crashes immediately upon launch. Both the iOS simulator and Android emulator in debug mode work fine. When I remove Sentry from my project, it works fine in both debug and release mode.

Steps to reproduce:
npm i --save react-native-sentry

react-native link react-native-sentry

cd android && ./gradlew assembleRelease and the equivalent xcode build

Actual result:
Android:

01-23 14:28:19.201  1095  1136 E AndroidRuntime: com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'e.constructor'), stack:
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:56)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:40)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
01-23 14:28:19.201  1095  1136 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)

iOS:

2018-01-23 14:46:39.759 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'e.constructor')
2018-01-23 14:46:39.768291-0700 MyApp[400:197824] undefined is not an object (evaluating 'e.constructor')
2018-01-23 14:46:39.774 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'e.constructor')
2018-01-23 14:46:39.774415-0700 MyApp[400:197818] Unhandled JS Exception: undefined is not an object (evaluating 'e.constructor')
2018-01-23 14:46:39.778 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2018-01-23 14:46:39.778528-0700 MyApp[400:197824] Module AppRegistry is not a registered callable module (calling runApplication)
2018-01-23 14:46:39.794411-0700 MyApp[400:197818] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'e.constructor')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'e.construct..., stack:
config@642:921
<unknown>@305:564
c@2:824
<unknown>@12:141
c@2:824
n@2:326
global code@851:8
'
*** First throw call stack:
(0x1846e9d04 0x183938528 0x10108be08 0x1010899e8 0x1846f1670 0x1845d06cc 0x1845d516c 0x10109f5a0 0x1010e130c 0x1010e106c 0x10180149c 0x10180145c 0x101810110 0x1018049a4 0x101811104 0x101818100 0x184312fd0 0x184312c20)
libc++abi.dylib: terminating with uncaught exception of type NSException

Expected result:
A working build

@HazAT HazAT self-assigned this Jan 25, 2018
@HazAT
Copy link
Member

HazAT commented Jan 25, 2018

Hey, I am looking at this right now.

@HazAT
Copy link
Member

HazAT commented Jan 25, 2018

@chrisshiplet
Can you change these lines

const sentryDsn = Platform.select({"ios":"__DSN__","android":"__DSN__"});
Sentry.config(sentryDsn).install();

into this:

Sentry.config("__DSN__").install();

Honestly, I don't know whats going on, but it seems Platform.select is not working correctly in release builds.

I will fix this and make a new release but this should do it for you.

@HazAT HazAT closed this as completed Jan 25, 2018
@HazAT HazAT mentioned this issue Jan 25, 2018
@chrisshiplet
Copy link
Author

That is extremely weird, and maybe explains why the stack trace wasn't very helpful. Thanks for looking into this!

@fungilation
Copy link

Note that I've seen similar immediate crash on launch, but hard to reproduce. It also only happens on device in release mode, not in simulator. But not all the time, only seems to happen after app has been in background (iOS) for a while (days) and need to wake with cold restart.

As it only happens occasionally, it's been hard to nail down on what lib is the cause so I'm not even sure if it is Sentry's fault. But when it does crash, it will keep crashing every subsequent launch until I rebuild/reinstall the app on device. And it crashes so early on at app launch that it crash to home screen immediately after the splash screen, and nothing turns up on Sentry reports.

@jeroenbourgois
Copy link

@fungilation we have similar behaviour, but probably not Sentry's fault. Nothing in Sentry reports either. How do you manage to get some sort of logs from the device when the app crashes? Running the app in debug mode while the device is connected through usb poses no problem, but when installing the (beta) app through the Play Store, it crashes instantly.

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

No branches or pull requests

4 participants