Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

feat: accept firebase 13 alongside firebase 12 - #3831

Open
armando-navarro wants to merge 2 commits into
angular:mainfrom
armando-navarro:a93-firebase-13
Open

armando-navarro wants to merge 2 commits into
angular:mainfrom
armando-navarro:a93-firebase-13

Conversation

@armando-navarro

@armando-navarro armando-navarro commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3830

  • Issue number for this PR: Accept firebase 13 in @angular/fire 22 #3830
  • Docs included?: no. The docs/version-22-upgrade.md changes go on the single rc.1 docs pull request, which merges just before the tag.
  • Test units included?: yes.
    • New specs in src/schematics/common.jasmine.ts.
    • A CI job that runs the specs against firebase 13.
  • Breaking change?: no. Apps on firebase 12 are unaffected.
  • In a clean directory, yarn install, yarn test run successfully? yes, with npm: npm ci, npm run build, npm run lint, npm run test:node and npm run test:chrome-headless.

Description

This lets @angular/fire 22 accept firebase 13 alongside 12, so ng add stops failing with ERESOLVE on apps that already have firebase 13. The reasoning is in the linked issue.

Changes

  • src/package.json:
    • Peer firebase is ^12.18.0 || ^13.0.0.
    • rxfire is ^6.3.0.
  • The repo still builds against firebase 12.
  • alignFirebaseVersion in src/schematics/common.ts, used by ng add and the v21 and v22 migrations:
    • It leaves an entry inside ^12.18.0 || ^13.0.0 alone.
    • When it writes an entry, it writes the range of the firebase major already installed.
    • It looks for node_modules/firebase in the workspace and then in each parent directory, so it also finds a monorepo root install.
    • It ignores an installed copy that the app's own entry excludes, since that copy is stale.
    • With nothing usable installed, an entry that starts at 13 gets ^13.0.0, and anything else gets ^12.18.0.
  • .github/workflows/test.yml has a new "Test firebase 13" job:
    • It runs test:node and test:chrome-headless on Node 24, with firebase 13.1.0 installed over the firebase 12 build.
    • It fails if 13.1.0 is not what got installed.
    • test_and_contribute and publish both wait on it.

Behavior to know

  • ng add @angular/fire on a new app with no firebase now writes ^13.0.0, because npm has already installed firebase 13 as the missing peer.
  • The v22 migration on an Angular 21 app that relied on the bundled firebase writes ^12.18.0, so the app stays on 12.
  • pnpm does not link an auto-installed peer at node_modules/firebase, so a new app on pnpm gets ^12.18.0 and one copy of firebase 12.
  • rxfire 6.3.0 now writes the idField onto the object a Firestore converter returns, instead of onto a copy.
    • With idField set, a converter that returns a frozen object now throws in collectionData and docData.
    • A fresh install with ^6.2.0 already resolves to 6.3.0.

Verified outside CI

  • ng add in fresh Angular 22 apps ended with one copy of firebase in every starting state I tried: no firebase, firebase 12 or 13 already installed, and entries like >=13.0.0, * and a firebase 13 prerelease.
  • ng update from Angular 21 to 22 kept each app on its existing firebase major.
  • An npm workspaces monorepo and a pnpm app each ended with one copy.
  • Apps on firebase 12 and on 13 ran Auth, Firestore, Realtime Database, Storage, Functions and AI calls against the emulators in Chrome with a clean console.

Tyler, the part I'd most like a second look at is the installed-version lookup in alignFirebaseVersion, since it reads outside the schematic tree.

firebase 13.1.0 is npm latest, so `npm install firebase` followed by
`ng add @angular/fire@22` failed with ERESOLVE against the ^12.18.0
peer. The peer range is now ^12.18.0 || ^13.0.0, and rxfire moves to
^6.3.0, whose peer range includes firebase 13.

The ng add and ng update schematics now write the range of the firebase
major already installed. ng add installs the missing peer at the newest
allowed version before the schematic runs, so writing ^12.18.0 over an
installed 13 left two @firebase/app copies and the app failed at
startup. The lookup walks up to a monorepo root, and an installed copy
the app's own entry excludes is ignored.

The package keeps building against firebase 12, the oldest supported
major, because the generated wrappers import functions by name from the
installed firebase. A new CI job runs the specs against firebase 13.1.0
on Node 24, which firebase 13 requires.

Fixes angular#3830
@armando-navarro armando-navarro added bump: minor Size of the change: a new capability with no breaking change comp: build/pipeline Build, bundling, packaging, release pipeline. comp: core FirebaseApp DI core (src/app). comp: schematics ng add / deploy schematics (src/schematics). dependencies Pull requests that update a dependency file type: feature New capability or enhancement. labels Oct 30, 2026
…ecursive option

Node 26 removed the recursive option of fs.rmdirSync, so the spec failed
in the Node 26 CI jobs. Delete the files and directories one by one
instead, as duplicatePackages.jasmine.ts already does.

@tyler-reitz tyler-reitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One blocking point: the monorepo spec's cleanup throws on Node 26, which is what fails all three Test Node 26 jobs.

rmdirSync(repository, { recursive: true }) is rejected there with The property 'options.recursive' is no longer supported; Node 24 only warns (DEP0147). Locally on Node 26, test:node reports 401 specs, 1 failure, "finds firebase installed at a monorepo root above the workspace", and the temp directory is left behind. The same tree on Node 24 passes 401/401. With @types/node at 12.12.41 there's no typed rmSync, so either a types bump or a cast; your call.

On the installed-version lookup you asked about: it reads _backend._root the same way setup/index.ts does, and walking up matches how Node resolves the package. Neutering the walk-up, the installed-version read, and the excluded-copy guard each turns its spec red, so the coverage holds. The one thing I'd note is that the walk-up has no stopping point: with no in-tree firebase and no firebase entry, a stray copy in an ancestor such as ~/node_modules decides the range. Node would resolve that same copy at runtime, so I read it as low risk (inferred, not run).

Everything else checked out, including the firebase 13 job and both browser suites.

@armando-navarro

Copy link
Copy Markdown
Collaborator Author

Thanks, Tyler.

The Node 26 failure is fixed in 5c5a8b9.

I went with neither a types bump nor a cast: the spec now deletes its temporary directory file by file, the way duplicatePackages.jasmine.ts already does, so it doesn't use rmdirSync's recursive option on any Node version.

That also removes the DEP0147 warning the old cleanup printed on Node 22 and 24.

Locally, test:node passes all 401 specs on Node 22, 24 and 26, and the temporary directory is removed.

On the walk-up, I agree it's low risk, so I've left it as is.

It only reaches above the app when the app's own node_modules has no firebase, and the copy it finds there only decides which range gets written, which the package manager then installs as the app's one copy.

Could you take another look?

@tyler-reitz tyler-reitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The removeDirectory helper fixes the Node 26 failure: all three Test Node 26 jobs pass on 5c5a8b9, along with the firebase 13 job and both browser suites.

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

Labels

bump: minor Size of the change: a new capability with no breaking change comp: build/pipeline Build, bundling, packaging, release pipeline. comp: core FirebaseApp DI core (src/app). comp: schematics ng add / deploy schematics (src/schematics). dependencies Pull requests that update a dependency file type: feature New capability or enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept firebase 13 in @angular/fire 22

2 participants