fix(deploy): target Node 22 and the firebase-functions/v1 API in generated Cloud Functions - #3743
Conversation
…rated Cloud Functions The generated function declared engines.node 14, a runtime Cloud Functions decommissioned in early 2025, so it could not deploy at all. The gen 1 template also called functions.region() on the firebase-functions package root, which moved to the /v1 subpath in v6, so a deployed function crashed at cold start with TypeError: functions.region is not a function. Node 22 is the newest runtime Cloud Functions supports and satisfies the engines ranges of @angular/core and firebase-admin. Node 20 would deploy today, but its security support ended 2026-04-30. The same constant picks the Cloud Run base image, now node:22-slim. The docs example moves off the decommissioned functionsNodeVersion 12.
tyler-reitz
left a comment
There was a problem hiding this comment.
LGTM, approving. Three non-blocking notes.
site/src/get-started/deploying.md:107 still has the same example at "functionsNodeVersion": 12. Nothing in .github/workflows builds site/, so it's not a deploy risk, but it's the other half of the docs fix.
The new comment above require('firebase-functions/v1') sits inside the parameter list, between functionName and ) =>. Legal, but it scans as a parameter annotation. Above export const defaultFunction would read better.
On tests: asserting defaultFunction(...) contains firebase-functions/v1 goes red against the old template and green against this one (verified the substring both ways). Cheap insurance before the 20.0.x cherry-pick.
One claim I couldn't check: firebase-admin engines >=18, since the package isn't installed until #3745 lands. Inference on my side, worth confirming before the cherry-pick.
Confirmed the core fix locally against firebase-functions 6.5.0: require('firebase-functions').region is undefined, require('firebase-functions/v1').region is a function.
|
Correcting one thing from my review above: I flagged the |
The site/ copy of the deploy guide still showed the decommissioned 12, flagged in review. Also fixes a spelling error on the same passage.
Add two specs for what the earlier commit in this PR fixed: the gen 1 template requires firebase-functions/v1, and the default runtime is 22. Both specs fail when run against the old template. Also moves the /v1 comment above the export so it no longer reads like a parameter annotation.
|
Thanks for the careful pass, and for checking the v1 claim against a real install. All 3 of your suggestions are implemented now:
|
Checklist
ng deploygenerates a Cloud Function that targets the decommissioned Node 14 runtime and crashes on firebase-functions 6 #3742 (required)TypeError: functions.region is not a function, the fixed one loads.yarn install,yarn testrun successfully?: yesDescription
Fixes #3742.
Three fixes to what
ng deploygenerates for Cloud Functions:DEFAULT_NODE_VERSIONgoes from 14 to 22.@angular/core(^20.19.0 || ^22.12.0 || >=24.0.0) andfirebase-admin(>=18).node:14-slimtonode:22-slim.firebase-functions/v1.functions.region(...)call threwTypeError: functions.region is not a functionon cold start./v1subpath is present on both firebase-functions 6 and 7.functionsNodeVersion: 22instead of the decommissioned 12.These defects also affect the v20 line and are planned for cherry-pick onto the 20.0.x release branch after this lands.