Skip to content

fix(deploy): declare firebase-admin in the generated Cloud Functions manifest - #3745

Merged
armando-navarro merged 3 commits into
angular:mainfrom
armando-navarro:fix/functions-manifest-admin-dep
Aug 12, 2026
Merged

fix(deploy): declare firebase-admin in the generated Cloud Functions manifest#3745
armando-navarro merged 3 commits into
angular:mainfrom
armando-navarro:fix/functions-manifest-admin-dep

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Checklist

Description

Fixes #3744.

Two dependency changes so the generated Cloud Functions manifest actually runs:

  • Add firebase-admin: ^13.0.0 to the root package.json.
    • The build resolves the generated manifest's versions from the root package.json. With no entry there, firebase-admin resolved to undefined and was silently dropped from the manifest.
    • firebase-functions 6.x declares firebase-admin as a required peer and requires it eagerly at module load, so the deployed function crashed at cold start wherever the package manager did not auto-install peers (--legacy-peer-deps, yarn 1, pnpm).
    • ^13.0.0 because firebase-functions 6.x accepts ^11.10.0 || ^12.0.0 || ^13.0.0 and nothing newer (firebase-admin 14 is outside the range).
  • Raise firebase-functions from ^6.1.0 to ^6.1.1.
    • 6.1.0's peer range excludes firebase-admin 13. 6.1.1 is the first release that accepts it, so the floor moves with the new entry.

These defects also affect the v20 line and are planned for cherry-pick onto the 20.0.x release branch after this lands.

…manifest

The root package.json had no firebase-admin entry, so the build resolved
its version to undefined and JSON.stringify dropped it from the generated
manifest. firebase-functions 6.x requires firebase-admin eagerly at
module load, so the deployed function crashed at cold start wherever
peers are not auto-installed (--legacy-peer-deps, yarn 1, pnpm).

firebase-functions moves to ^6.1.1, the first release whose peer range
accepts firebase-admin 13.
@armando-navarro armando-navarro added bump: patch comp: schematics ng add / deploy schematics (src/schematics). comp: ssr Server-side rendering, hydration, @angular/ssr interop. type: bug Defect: expected behavior doesn't happen. labels Aug 11, 2026

@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.

LGTM, approving. Verified the core claim by replicating tools/build.ts and actions.ts against both branches: on main the generated manifest comes out as {"firebase-functions":"^6.1.0"} with firebase-admin absent, and with this PR both entries appear. The registry ranges check out too, including that ^6.1.1 resolves to 6.6.0 today and still peers on ^13.

One non-blocking suggestion, and it's the reason I'd rather see it in this series than later.

replaceSchematicVersions assigns root.dependencies[name] || root.devDependencies[name] with no guard (tools/build.ts:299, and the same shape at :296 for peerDependencies). When that resolves falsy, JSON.stringify drops the key and the package vanishes from every deployed function's manifest with no build error. The 0.0.0 placeholder in versions.json makes the entry look populated when it isn't, which is what made #3744 hard to spot.

A throw when the resolved version is falsy turns this from a broken cold start into a failed build. The peerDependencies loop is empty today, so nothing exercises it, which is exactly when this comes back.

replaceSchematicVersions resolved versions from the root package.json
with no check, and a missing entry was silently dropped from the
shipped versions.json by JSON.stringify. That is how the generated
Cloud Functions manifest lost firebase-admin (angular#3744). The build now
throws, naming the package, and both loops share the guard.
@armando-navarro

Copy link
Copy Markdown
Collaborator Author

Thanks for replicating the manifest generation on both branches.

Your suggestion is implemented:

  • replaceSchematicVersions now resolves every version through a helper that throws when the lookup comes back empty, naming the package
  • Both loops go through it, including the empty peerDependencies one so the guard is already standing if that block ever repopulates.

@armando-navarro
armando-navarro merged commit b257054 into angular:main Aug 12, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch comp: schematics ng add / deploy schematics (src/schematics). comp: ssr Server-side rendering, hydration, @angular/ssr interop. type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The generated Cloud Functions manifest omits firebase-admin, so the deployed function crashes wherever peers are not auto-installed

2 participants