Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in firebase-admin dependency: '@firebase/app' does not contain a default export (imported as 'firebase'). #1434

Closed
taletski opened this issue Sep 14, 2021 · 3 comments
Assignees

Comments

@taletski
Copy link

Environment

  • Operating System version: macOS Big Sur 11.5.1 (20G80)
  • Firebase SDK version: 9.0.2
  • Firebase Product: database
  • Node.js version: 16.7.0
  • NPM version: 7.20.3
  • Yarn version: 1.22.11

The problem

After the installation to the Next.js (v10.0.5) environment the project compiling fails with an error:

error - ./node_modules/firebase-admin/node_modules/@firebase/database/dist/index.esm.js
Attempted import error: '@firebase/app' does not contain a default export (imported as 'firebase').

I was only able to 'fix' it by changing import firebase from '@firebase/app' to import * as firebase from '@firebase/app' in ./node_modules/firebase-admin/node_modules/@firebase/database/dist/index.esm.js.

Is that the firebase-admin obsolete dependency issue?

Steps to reproduce:

  1. Install the firebase-admin to the Next.js project: yarn add firebase-admin;
  2. Run next dev server: yarn dev;
  3. See that it won't compile because of the following error:
error - ./node_modules/firebase-admin/node_modules/@firebase/database/dist/index.esm.js
Attempted import error: '@firebase/app' does not contain a default export (imported as 'firebase').
@hiranya911
Copy link
Contributor

@Feiyang1 do you have any idea what this is about?

@Feiyang1
Copy link
Member

We accidentally removed the export that the admin SDK uses in v9, and removed the condition that prevent @firebase/app from being evaluated when used in the admin SDK. I will add them back.

Before the fix is released, the admin SDK has to use @firebase/database version 0.11.x or below. You will need to manually remove /node_modules/firebase-admin/node_modules/@firebase/database, and install a compatible @firebase/database version. It can become complicated if you are also using the firebase package because of package hoisting.

I can make an emergency release, so it may be better to just wait for the fix in the next firebase release.

@hiranya911
Copy link
Contributor

Fixed in v9.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants