I can't get my app to work in Testflight after upgrading from Expo SDK 44 (expo build) to SDK 47 with EAS. So far, I got the app working in Expo. But when I build with EAS and try to run it, it crashes after the splash screen.
Crash log mentions EXUpdatesErrorRecovery.m but a search on the internet so far only learned me it can be anything.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 2
Last Exception Backtrace:
0 CoreFoundation 0x18da4de88 __exceptionPreprocess + 164 (NSException.m:202)
1 libobjc.A.dylib 0x186d838d8 objc_exception_throw + 60 (objc-exception.mm:356)
2 MetarTaf 0x102d8b3bc -[EXUpdatesAppController throwException:] + 24 (EXUpdatesAppController.m:485)
3 MetarTaf 0x102d9cbd8 -[EXUpdatesErrorRecovery _crash] + 768 (EXUpdatesErrorRecovery.m:268)
4 MetarTaf 0x102d9c420 -[EXUpdatesErrorRecovery _runNextTask] + 200 (EXUpdatesErrorRecovery.m:184)
5 libdispatch.dylib 0x19501c4b4 _dispatch_call_block_and_release + 32 (init.c:1518)
6 libdispatch.dylib 0x19501dfdc _dispatch_client_callout + 20 (object.m:560)
7 libdispatch.dylib 0x195025694 _dispatch_lane_serial_drain + 672 (inline_internal.h:2632)
8 libdispatch.dylib 0x1950261e0 _dispatch_lane_invoke + 384 (queue.c:3940)
9 libdispatch.dylib 0x195030e10 _dispatch_workloop_worker_thread + 652 (queue.c:6846)
10 libsystem_pthread.dylib 0x1daaa3df8 _pthread_wqthread + 288 (pthread.c:2618)
11 libsystem_pthread.dylib 0x1daaa3b98 start_wqthread + 8 (:-1)
Incident Identifier: A562E67E-ABF6-4196-B5DD-ACED79363679
Hardware Model: iPhone14,5
Process: -- [16963]
Path: --
Identifier: --
Version: 2.4.0 (2.4.5)
AppStoreTools: 14C17
AppVariant: 1:iPhone14,5:16
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: -- [2764]
Date/Time: 2023-01-28 11:53:14.2711 +0100
Launch Time: 2023-01-28 11:53:13.6737 +0100
OS Version: iPhone OS 16.1.1 (20B101)
Release Type: User
Baseband Version: 2.12.02
Report Version: 104
.. "dependencies": {
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-clipboard/clipboard": "^1.11.1",
"@react-navigation/material-bottom-tabs": "^6.2.11",
"@react-navigation/material-top-tabs": "^6.5.2",
"@react-navigation/native-stack": "^6.9.8",
"deprecated-react-native-prop-types": "^4.0.0",
"expo": "^47.0.0",
"expo-application": "~5.0.1",
"expo-constants": "~14.0.2",
"expo-device": "~5.0.0",
"expo-file-system": "~15.1.1",
"expo-font": "~11.0.1",
"expo-linking": "~3.3.0",
"expo-localization": "~14.0.0",
"expo-location": "~15.0.1",
"expo-notifications": "~0.17.0",
"expo-speech": "~11.0.0",
"expo-status-bar": "~1.4.2",
"expo-store-review": "~6.0.0",
"expo-system-ui": "~2.0.1",
"expo-updates": "~0.15.6",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "0.70.5",
"react-native-elements": "^3.4.3",
"react-native-gesture-handler": "~2.8.0",
"react-native-pager-view": "6.0.1",
"react-native-paper": "^4.12.5",
"react-native-popup-menu": "^0.15.13",
"react-native-root-toast": "^3.3.1",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-stack": "^1.0.0-alpha11",
"react-native-svg": "13.4.0",
"react-native-swipeable": "^0.6.0",
"react-native-tab-view": "^3.3.4",
"react-native-vector-icons": "^9.2.0",
"react-native-web": "~0.18.7",
"react-native-webview": "11.23.1",
"react-navigation": "^4.4.4" }, "devDependencies": {
"@babel/core": "^7.19.3",
"typescript": "^4.6.3" }, ..
UPDATE:
When the crash occurs, I find some errors in the XCode console that I have already solved in my local environment. To do so, I had to hack into node_modules for react-native-swipeable and react-native itself, per the instructions listed here: Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'
Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
Unhandled JS Exception: Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.
..
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
It seems that EAS is trying to build the application with a different node_modules directory.
Hope anyone can help me with it.
EAS maintains its own copy of node_modules. So altering scripts in local node_modules will have no effect for the production build.
Both the react-native package (0.70.5) and react-native-swipeable (0.6.0) are not properly maintained and don't work as they are released. They still use ViewPropTypes that have been dropped from React Native. There is a workaround by using the deprecated-react-native-prop-types package.
To use the deprecated proptypes package, you need to manually alter node_modules. But those changes aren't sent to EAS.
Patch-package takes care of that, by replaying changes you made on the server-side as well.
Per its documentation I installed patch-package (see https://www.npmjs.com/package/patch-package). First added the post-install hook in app.json:
"scripts": {
+ "postinstall": "patch-package"
}
Then I installed the npm package:
npm i patch-package
Next I registered the patched packages:
npx patch-package react-native
npx patch-package react-native-swipeable
And started a new EAS build with clear cache, to be sure:
eas build -p ios --clear-cache
You can check the Expo > Build Details > Prebuild to see if the patches are applied remotely:
- Config syncing
✔ Config synced
Running "npm install" in the root dir of your repository
> [email protected] postinstall
> patch-package
patch-package 6.5.1
Applying patches...
[email protected] ✔
[email protected] ✔
added 8 packages, and audited 1331 packages in 2s
83 packages are looking for funding
run `npm fund` for details
9 high severity vulnerabilities
Hope this helps anyone with the same issue.