fix(deploy): declare firebase-admin in the generated Cloud Functions manifest - #3745
Conversation
…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.
tyler-reitz
left a comment
There was a problem hiding this comment.
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.
|
Thanks for replicating the manifest generation on both branches. Your suggestion is implemented:
|
Checklist
firebase-admin, so the deployed function crashes wherever peers are not auto-installed #3744 (required)npm installand--legacy-peer-depsand both function entry points load, while today's generated manifest under--legacy-peer-depscrashes withCannot find module 'firebase-admin/app-check'.yarn install,yarn testrun successfully?: yesDescription
Fixes #3744.
Two dependency changes so the generated Cloud Functions manifest actually runs:
firebase-admin: ^13.0.0to the rootpackage.json.package.json. With no entry there,firebase-adminresolved toundefinedand was silently dropped from the manifest.firebase-adminas 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.0because firebase-functions 6.x accepts^11.10.0 || ^12.0.0 || ^13.0.0and nothing newer (firebase-admin14 is outside the range).firebase-functionsfrom^6.1.0to^6.1.1.6.1.0's peer range excludesfirebase-admin13.6.1.1is 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.