I am working on an expo-managed react native app that uses firebase to authenticate users and react-navigation to manage navigation. The app compiles and runs fine in both Expo Go and using EAS Build, however when I upload it to testflight I get an "EXC_CRASH (SIGABRT)" error immediately on launch of the app. Former solutions to this problem were based on permissions, but I don't ask nor need any special permissions from the user, so that doesn't help in my case. Any help would be greatly appreciated, as I have been trying to debug this for the past week!
Here are the relevant parts of the testflight crash logs (I have removed the app name with TestApp):
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 2
Last Exception Backtrace:
0 CoreFoundation 0x1c29f1d78 __exceptionPreprocess + 220 (NSException.m:200)
1 libobjc.A.dylib 0x1db656734 objc_exception_throw + 60 (objc-exception.mm:565)
2 TestApp 0x104c89e7c RCTFatal + 668 (RCTAssert.m:146)
3 TestApp 0x104d08f38 -[RCTExceptionsManager reportFatal:stack:exceptionId:] + 488 (RCTExceptionsManager.mm:68)
4 TestApp 0x104d09818 -[RCTExceptionsManager reportException:] + 1408 (RCTExceptionsManager.mm:135)
5 CoreFoundation 0x1c297a614 __invoking___ + 148
6 CoreFoundation 0x1c2998100 -[NSInvocation invoke] + 468 (NSForwarding.m:3378)
7 CoreFoundation 0x1c29cf13c -[NSInvocation invokeWithTarget:] + 80 (NSForwarding.m:3475)
8 TestApp 0x104cbca48 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 460 (RCTModuleMethod.mm:584)
9 TestApp 0x104cbf03c facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 540 (RCTNativeModule.mm:183)
10 TestApp 0x104cbec6c operator() + 68 (RCTNativeModule.mm:104)
11 TestApp 0x104cbec6c invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 112 (RCTNativeModule.mm:95)
12 libdispatch.dylib 0x1c2656e68 _dispatch_call_block_and_release + 32 (init.c:1517)
13 libdispatch.dylib 0x1c2658a2c _dispatch_client_callout + 20 (object.m:560)
14 libdispatch.dylib 0x1c2660124 _dispatch_lane_serial_drain + 668 (inline_internal.h:2622)
15 libdispatch.dylib 0x1c2660c80 _dispatch_lane_invoke + 392 (queue.c:3944)
16 libdispatch.dylib 0x1c266b500 _dispatch_workloop_worker_thread + 648 (queue.c:6732)
17 libsystem_pthread.dylib 0x23394e0bc _pthread_wqthread + 288 (pthread.c:2599)
18 libsystem_pthread.dylib 0x23394de5c start_wqthread + 8
Here is what the relevant portions of my App.js looks like:
initializeApp(firebaseConfig);
const Tab = createMaterialBottomTabNavigator();
const Stack = createNativeStackNavigator();
const [user, setUser] = useState(false);
const [loading, setLoading] = useState(true);
const auth = getAuth();
onAuthStateChanged(auth, (user) => {
if (user) {
setUser(true);
} else {
setUser(false);
}
setLoading(false);
});
if(loading){
return(<AppLoading />)
}
return (
<SafeAreaProvider>
<NavigationContainer>
{user ? (
<MainApp />
) : (
<Onboarding />
)}
</NavigationContainer>
</SafeAreaProvider>
);
Any my dependencies are as follows:
"dependencies": {
"@emotion/styled": "^11.9.3",
"@expo/vector-icons": "^13.0.0",
"@mui/icons-material": "^5.8.4",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-clipboard/clipboard": "^1.10.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-navigation/material-bottom-tabs": "^6.2.1",
"@react-navigation/native": "^6.0.10",
"@react-navigation/native-stack": "^6.6.2",
"@react-navigation/stack": "^6.2.1",
"@react-spring/native": "^9.4.5",
"axios": "^0.27.2",
"expo": "~45.0.0",
"expo-app-loading": "~2.0.0",
"expo-fast-image": "^1.1.3",
"expo-file-system": "~14.0.0",
"expo-linking": "~3.1.0",
"expo-modules-autolinking": "~0.8.1 || ~0.9.0",
"expo-react-native-fast-image": "^2.0.0",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-system-ui": "~1.2.0",
"firebase": "^9.8.4",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-gesture-handler": "~2.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-paper": "^4.12.1",
"react-native-safe-area-context": "4.2.4",
"react-native-unimodules": "^0.15.0",
"react-native-web": "0.17.7",
"react-progressive-graceful-image": "^0.6.14",
"react-spring": "^8.0.27",
"react-tinder-card": "^1.4.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/plugin-proposal-export-namespace-from": "^7.18.6",
"@types/react": "~17.0.21",
"@types/react-native": "~0.67.6",
"typescript": "~4.3.5"
},
Again, any push in the right direction would be greatly appreciated, and thank you in advance for any help!
Edit: Here is a list of things that I have tried
- Uninstalling, reinstalling, and validating different versions of Expo and React Native
- Removing all auth hooks from firebase
- Refactoring the auth flow
- Moving the initialize firebase key from outside to inside the app.js export