vuejs / vuefire

🔥 Firebase bindings for Vue.js
https://vuefire.vuejs.org
MIT License
3.82k stars 323 forks source link

Dependency errors for latest versions of `firebase-functions` and `firebase-admin` #1538

Closed BenJackGill closed 1 month ago

BenJackGill commented 1 month ago

Reproduction

https://github.com/posva/nuxt--vuefire-repro-template

Steps to reproduce the bug

1) Download the normal example repo 2) Run npm i and everything installs fine 3) Then in packages.json change firebase-functions to ^5.0.1, and change firebase-admin to ^12.1.1 and save the file 4) Run npm i again and you will see the below installation errors

When changing to the latest firebase-functions@^5.0.1 it causes this error to be thrown:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: nuxt-vuefire@0.4.1
npm ERR! Found: firebase-functions@5.0.1
npm ERR! node_modules/firebase-functions
npm ERR!   firebase-functions@"^5.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional firebase-functions@"^4.1.0" from nuxt-vuefire@0.4.1
npm ERR! node_modules/nuxt-vuefire
npm ERR!   nuxt-vuefire@"^0.4.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: firebase-functions@4.9.0
npm ERR! node_modules/firebase-functions
npm ERR!   peerOptional firebase-functions@"^4.1.0" from nuxt-vuefire@0.4.1
npm ERR!   node_modules/nuxt-vuefire
npm ERR!     nuxt-vuefire@"^0.4.1" from the root project

When changing to the latest firebase-admin@^12.1.1 it causes this error to be thrown:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: nuxt-vuefire@0.4.1
npm ERR! Found: firebase-admin@12.1.1
npm ERR! node_modules/firebase-admin
npm ERR!   firebase-admin@"^12.1.1" from the root project
npm ERR!   peer firebase-admin@"^10.0.0 || ^11.0.0 || ^12.0.0" from firebase-functions@4.9.0
npm ERR!   node_modules/firebase-functions
npm ERR!     firebase-functions@"^4.5.0" from the root project
npm ERR!     peerOptional firebase-functions@"^4.1.0" from nuxt-vuefire@0.4.1
npm ERR!     node_modules/nuxt-vuefire
npm ERR!       nuxt-vuefire@"^0.4.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional firebase-admin@"^11.3.0" from nuxt-vuefire@0.4.1
npm ERR! node_modules/nuxt-vuefire
npm ERR!   nuxt-vuefire@"^0.4.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: firebase-admin@11.11.1
npm ERR! node_modules/firebase-admin
npm ERR!   peerOptional firebase-admin@"^11.3.0" from nuxt-vuefire@0.4.1
npm ERR!   node_modules/nuxt-vuefire
npm ERR!     nuxt-vuefire@"^0.4.1" from the root project

Expected behavior

No dependency errors

Actual behavior

Has dependency errors

Additional information

No response

posva commented 1 month ago

Install with pnpm. There is a pnpm-lock 😄

BenJackGill commented 1 month ago

Ok I'll finally give pnpm a try 😄 Does this mean VueFire is not package manager agnostic? I thought plain npm was supported.

posva commented 1 month ago

In your project use what you want. But note install errors are not coming from here, just the setup

ingljoOpt commented 2 weeks ago

I get the same error. Isn't it because of the peerDependencies in the nuxt-vuefire package?

 "peerDependencies": {
    "@firebase/app-types": ">=0.8.1",
    "firebase": "^9.0.0 || ^10.0.0",
    "firebase-admin": "^11.3.0",
    "firebase-functions": "^4.1.0",
    "vuefire": ">=3.1.23"
  },

This is npm install error message when using firebase-admin v.12.11.1

npm error While resolving: nuxt-vuefire@1.0.2
npm error Found: firebase-admin@12.1.1
npm error node_modules/firebase-admin
npm error   dev firebase-admin@"^12.1.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional firebase-admin@"^11.3.0" from nuxt-vuefire@1.0.2
npm error node_modules/nuxt-vuefire
npm error   dev nuxt-vuefire@"^1.0.2" from the root project
npm error
npm error Conflicting peer dependency: firebase-admin@11.11.1
npm error node_modules/firebase-admin
npm error   peerOptional firebase-admin@"^11.3.0" from nuxt-vuefire@1.0.2
npm error   node_modules/nuxt-vuefire
npm error     dev nuxt-vuefire@"^1.0.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

Also included is the audit report for why it is urgent to update the firebase-admin package to 12.11.1:

# npm audit report

protobufjs  7.0.0 - 7.2.4
Severity: critical
protobufjs Prototype Pollution vulnerability - https://github.com/advisories/GHSA-h755-8qp9-cq85
fix available via `npm audit fix --force`
Will install firebase-admin@12.1.1, which is a breaking change
node_modules/google-gax/node_modules/protobufjs
  google-gax  2.2.1-pre - 2.2.1-pre.2 || 2.28.2-alpha.1 - 2.28.4-alpha.1 || 3.1.4 - 4.0.3
  Depends on vulnerable versions of protobufjs
  node_modules/google-gax
    @google-cloud/firestore  6.1.0-pre.0 - 6.8.0
    Depends on vulnerable versions of google-gax
    node_modules/@google-cloud/firestore
      firebase-admin  11.1.0 - 11.11.1
      Depends on vulnerable versions of @google-cloud/firestore
      node_modules/firebase-admin
        nuxt-vuefire  >=0.0.2
        Depends on vulnerable versions of firebase-admin
        node_modules/nuxt-vuefire
ingljoOpt commented 2 weeks ago

@BenJackGill This issue should probably be reopened?

BenJackGill commented 2 weeks ago

I am not the owner of the repo and I did not close the issue. Reopening the issue would be up to @posva.

I also believe it to be a problem and was confused by his earlier response about it being a setup issue, but since this is not my repo I assumed he knew best. Maybe he will take another look.

posva commented 2 weeks ago

This was about something else in a different repo.

the version mismatch requires updating the version of Firebase admin and it’s already planned and tracked I just haven’t had the time lately for it

davidstackio commented 5 days ago

Something is broken. I'm trying to follow the instructions here: https://vuefire.vuejs.org/nuxt/getting-started.html

But npx nuxi@latest module add vuefire doesn't work. I get the error below.

I tried a workaround using the old versions of the modules: npm i --save firebase-admin@11 firebase-functions@4, but I kept getting this error after running npm run dev:

 ERROR  Pre-transform error: Failed to resolve import "@firebase/auth" from "node_modules/firebase/auth/dist/esm/index.esm.js?v=b1737bf2". Does the file exist? (x4) 

As @ingljoOpt said, there are critical security issues that are fixed in the latest version of firebase-admin, so getting this addressed quickly seems prudent.

Logs

ℹ Installing nuxt-vuefire@latest development dependency                                                                                                                                                                                                                                                   7:08:43 PM
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: nuxt-vuefire@1.0.2
npm error Found: firebase-functions@5.0.1
npm error node_modules/firebase-functions
npm error   firebase-functions@"^5.0.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional firebase-functions@"^4.1.0" from nuxt-vuefire@1.0.2
npm error node_modules/nuxt-vuefire
npm error   dev nuxt-vuefire@"1.0.2" from the root project
npm error
npm error Conflicting peer dependency: firebase-functions@4.9.0
npm error node_modules/firebase-functions
npm error   peerOptional firebase-functions@"^4.1.0" from nuxt-vuefire@1.0.2
npm error   node_modules/nuxt-vuefire
npm error     dev nuxt-vuefire@"1.0.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\David\AppData\Local\npm-cache\_logs\2024-06-25T23_08_44_465Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\David\AppData\Local\npm-cache\_logs\2024-06-25T23_08_44_465Z-debug-0.log

 ERROR  Command failed with exit code 1: npm install -D nuxt-vuefire@latest                                                                                                                                                                                                                                7:08:53 PM  

  at makeError (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/chunks/index3.mjs:1272:11)
  at handlePromise (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/chunks/index3.mjs:2510:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async executeCommand (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.0f575f79.mjs:42:3)
  at async addDependency (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.0f575f79.mjs:197:3)
  at async Object.setup (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/chunks/add2.mjs:26228:19)
  at async runCommand$1 (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1620:5)
  at async runCommand$1 (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1639:11)
  at async runCommand$1 (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1639:11)
  at async runMain$1 (/C:/Users/David/Documents/GitHub/elora/node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1777:7)

✔ Install failed for nuxt-vuefire@latest. Do you want to continue adding the module to nuxt.config?

Nuxi Info

Nuxt project info:                                                                                                                                                                                                                                                                                         8:16:02 PM

------------------------------
- Operating System: Windows_NT
- Node Version:     v20.11.1
- Nuxt Version:     3.12.2
- CLI Version:      3.12.0
- Nitro Version:    2.9.6
- Package Manager:  npm@10.8.1
- Builder:          -
- User Config:      extends, modules, sanity, vuefire, site
- Runtime Modules:  nuxt-vuefire@1.0.2
- Build Modules:    -
------------------------------