Firebase signIn issue in React Native Expo production build - Crashes after selecting Google account

I am facing a critical issue in my React Native app where the app crashes abruptly after selecting a Google account during the signin process, but only in the production build. In the development build (Expo), the app works fine without any crashes. The next time the app opens the checkedSignIn function works fine which means sign in was successful but the doc is not created in the firestore. Overview: -The issue occurs specifically in the production build of my React Native app. -The crash happens after selecting a Google account during the signin process. -The expected behavior is to complete the signin process and setUser() to the logged in user. -The app works fine in the development build (Expo) without any crashes or issues. After further logging it looks like the code stops at this line as no further logs are shown after this and app crashes: const { user } = await auth().signInWithCredential(googleCredential); Relevant Code: Here is the relevant code snippet from my useAuth hook:
js// ...

const signInWithGoogle = async () => {
try {
setLoading(true);
await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
const { idToken } = await GoogleSignin.signIn();
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
const { user } = await auth().signInWithCredential(googleCredential);
await setUserInFirestore(user);


} catch (error) {
setError(error);
console.log("Error signing in with Google:", error);
}
};
js// ...

const signInWithGoogle = async () => {
try {
setLoading(true);
await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
const { idToken } = await GoogleSignin.signIn();
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
const { user } = await auth().signInWithCredential(googleCredential);
await setUserInFirestore(user);


} catch (error) {
setError(error);
console.log("Error signing in with Google:", error);
}
};
Versions: React Native: 0.71.8 Expo: ~48.0.15 @react-native-firebase/app: ^17.4.3 @react-native-firebase/auth: ^17.4.3 @react-native-google-signin/google-signin: ^9.0.2 Firebase: ^9.21.0
0 Replies
No replies yetBe the first to reply to this messageJoin