expo firebase analytics throwing errors after upgrade to expo 43

Please provide the following:

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): web
  3. expo-firebase-analytics. (import * as Analytics from ‘expo-firebase-analytics’:wink:

It appears to only happen on the web. Web bundler threw this error so likely related…

Module not found: Error: Can’t resolve ‘firebase/compat/analytics’ in ‘/Users/soleary/smarthub/node_modules/expo-firebase-analytics/build’
Module not found: Error: Can’t resolve ‘firebase/compat/app’ in ‘/Users/soleary/smarthub/node_modules/expo-firebase-analytics/build’

@pocketencasa Please check that you had installed all dependencies of firebase and others . and check if you wrote the correct code there could be a code error also.

Hey @pocketencasa, can you let me know what firebase version the project is running?

@adamjnav I’m running 8.2.3 still. I just ran expo upgrade to 43 and then encountered these errors. I tried going to firebase 9 but that is EVEN WORSE and triggers all sort of errors with phone login and email login that I know firebase needs to fix and @bycedric is working with them on.

I would like to resolve this WITHOUT going to firebase v9 if possible right now.

I noticed in expo 43 upgrade the expo-firebase-analytics went from 4.1.0 to 5.0.3. Probably the source of the issue. Can i just downgrade it?

I ended up solving this by manually reverting the two imports in expo-firebase-analytics from ‘firebase/compat/…’ to just ‘firebase/…’ in the below two files in the build directory thus taking it back from firebase v9 to firebase v8 syntax. Then used patch-package to make a patch for this change.

Kept firebase v8 in my package.json and expo-firebase-analytics is at version 5.0.3 as installed by expo upgrade but of course now patched by the above…

“expo-firebase-analytics”: “5.0.3”,

1 Like

Fortunately none of the firebase functionality I use is broken in v9 so I resolved the issue by running expo install firebase to upgrade it to version ^9.2.0. I guess it should’ve been upgraded automatically when running expo upgrade, but it wasn’t.

1 Like

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