firebase.auth undefined after SDK42 update

I have a fully-managed app I’ve been building for some time on SDK41. I updated to SDK42 and had a problem, so I did a cleaned up the node_modules directory and did a fresh npm install. After that, the app started running but I cannot get the firebase.auth call to work — it comes up as undefined, and I haven’t changed anything there. Maybe in the course of the cleanup I wound up on a newer version of the firebase npm, but in any case, I’m stumped. My firestore has one collection that doesn’t need auth permissions, and it’s accessible, which tells me that firebase itself is getting initialized properly.

The code looks pretty vanilla:

import * as firebase from 'firebase'
import "firebase/firestore"
import "firebase/auth"
import { FirebaseConfig } from '../shared'

function RootNavigator() {
  if (!firebase.apps.length) {

  React.useEffect(() => {
    firebase.auth().onAuthStateChanged((user) => {
      authContext.userProfile = user
      if (!user)
  }, []); 

This is the error that gets thrown:

TypeError: firebase.auth is not a function. (In 'firebase.auth()', 'firebase.auth' is undefined)

This error is located at:
    in RootNavigator (at navigation/index.tsx:31)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:409)
    in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:91)
    in ThemeProvider (at NavigationContainer.tsx:90)
    in ForwardRef(NavigationContainer) (at navigation/index.tsx:28)
    in Navigation (at App.tsx:22)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at App.tsx:21)
    in App (created by ExpoRoot)
    in ExpoRoot (at renderApplication.js:45)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:34)
    in View (at react-native-root-siblings/index.js:32)
    in RootSiblingsWrapper (at AppContainer.js:121)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:132)
    in AppContainer (at renderApplication.js:39)

All of this was working prior to this update, but I don’t know what the connection would be to the SDK update.

SDK 42, both iOS/Android have this behavior.

1 Like

Not sure why this showed up today, but I eventually resolved it by removing both the firebase NPM and another (@firebase/firestore@2.3.8) that had been installed. After removing both and then doing a clean npm install firebase everything was happy again. The @firebase npm was no longer anywhere in sight.


Thanks for following up with what resolved the issue, @fitterman! :clap:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.