firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.63k stars 371 forks source link

Doesn't provide peer deps when using Yarn v2 #973

Open nicholaschiang opened 4 years ago

nicholaschiang commented 4 years ago

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

This doesn't support Yarn v2 because some of the @firebase packages don't provide their dependent's peer dependencies (e.g. @firebase/auth doesn't provide @firebase/util which is requested by @firebase/auth-types).

You should:

Steps to reproduce:

  1. Clone this repository by running:
    $ git clone https://github.com/tutorbookapp/tutorbook
  2. Check out to develop and fetch the latest changes:
    $ git checkout develop && git pull
  3. Make sure you have Yarn installed and then run:
    $ yarn install
  4. Notice that there are warnings about @firebase/database and @firebase/auth not providing their dependency's peer dependencies:
    ➤ YN0002: │ @firebase/database@npm:0.6.9 doesn't provide @firebase/app-types@0.x requested by @firebase/auth-interop-types@npm:0.1.5
    ➤ YN0002: │ @firebase/auth@npm:0.14.9 [387e6] doesn't provide @firebase/app-types@0.x requested by @firebase/auth-types@npm:0.10.1
    ➤ YN0002: │ @firebase/auth@npm:0.14.9 [387e6] doesn't provide @firebase/util@0.x requested by @firebase/auth-types@npm:0.10.1
nicholaschiang commented 4 years ago

Temporary fix is to use the packageExtensions config in .yarnrc.yml (see docs):

  "@firebase/database@0.x":
    peerDependencies:
      "@firebase/app-types": "0.x"
  "@firebase/auth@0.x":
    peerDependencies:
      "@firebase/app-types": "0.x"
      "@firebase/util": "0.x"

Once I did that, I got a warning about firebase-admin:

➤ YN0002: │ firebase-admin@npm:9.0.0 doesn't provide @firebase/app-types@0.x requested by @firebase/database@npm:0.6.9

So, I added that to the packageExtensions as well:

  firebase-admin@9.0.x:
    dependencies:
      "@firebase/app-types": "0.x"

And it looks fine now.

hiranya911 commented 4 years ago

None of the above action items can be addressed in this repo. Is there anything that needs to be done in this codebase?

@Feiyang1 what do you think of the above?

Feiyang1 commented 3 years ago

We can fix every package except for @firebase/database. Fixing it for @firebase/database will bring https://github.com/firebase/firebase-admin-node/issues/614 back.

I'm pondering if we should add @firebase/app(-type) back to @firebase/database's peerDependencies as it also breaks our compatibility with Yarn2 in the JS SDK repo. see https://github.com/firebase/firebase-js-sdk/issues/3707

The downside is admin SDK users will start seeing https://github.com/firebase/firebase-admin-node/issues/614 again. Maybe we should talk about creating a @firebase/database-standalone package again, as the workaround in place seems to start causing compatibility issues with newer tools.

nicholaschiang commented 3 years ago

@hiranya911 @Feiyang1 Any update on this yet? I'm still seeing these warnings...

0xdevalias commented 3 years ago

FYI: https://github.com/firebase/firebase-admin-node/issues/1241 / https://github.com/firebase/firebase-admin-node/pull/1250 were opened recently about upgrading @firebase/database and similar dependencies, which may potentially resolve the issues here when merged?

m4rvr commented 2 years ago

Seems still not fixed yet. Using pnpm here.

johste93 commented 1 year ago

Will this be addressed?

hsubox76 commented 1 year ago

So when I install the latest version of firebase-admin with Yarn2 into a new project, this is the only dependency warning I get:

➤ YN0000: ┌ Resolution step
➤ YN0002: │ @firebase/database@npm:0.13.10 doesn't provide @firebase/app-types (pc007b), requested by @firebase/auth-interop-types
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 2s 679ms

Is anyone seeing additional warnings about additional packages? I just want to make sure I have a full list of the problem packages to fix, and the specific packages the warnings are about seem to have changed since the original 2020 post at the top.

In addition to spot-fixing any problem packages, we're also looking into a more comprehensive solution to prevent issues like this in the future.

Note to self: The warning above can be fixed by removing the peerDependencies in auth-interop-types: https://github.com/firebase/firebase-js-sdk/blob/f2923228a9725b330ad6da21073bb2fdbb263027/packages/auth-interop-types/package.json#L15 I don't think they belong there at all and I suspect they are a copy-paste error way back when the package was created.

ermish commented 1 year ago

any updates on this?