Skip to content

Disabled support for node 22 in first-generation functions. An error occurs when deploying functions. #1653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
siarheidudko opened this issue Dec 14, 2024 · 10 comments
Labels
deploy Deployment related issues Needs: Attention reproducible: yes Issue with a repro triaged Triaged

Comments

@siarheidudko
Copy link

Related issues

[REQUIRED] Version info

node:

22.9.0

firebase-functions:

6.1.2

firebase-tools:

13.29.1

firebase-admin:

13.0.1

[REQUIRED] Test case

image

Node v22 support for 1st generation functions has disappeared.

[REQUIRED] Steps to reproduce

  1. Specify engines (node 22) in package.json:
"engines": {
    "node": "22"
  },
  1. Use the 1st and 2nd generation functions. (Some functions cannot be migrated to the 2nd generation at the moment, for example authentication triggers.)
  2. Just run command: firebase deploy -m "message" --only functions --force

[REQUIRED] Expected behavior

The functions should be deployed in the same way as it happened from August to November 2024. I have updated the engine from v20 to v22 in August 2024
image

[REQUIRED] Actual behavior

image image
{
  "protoPayload": {
    "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
    "status": {
      "code": 3,
      "message": "runtime: Runtime validation errors: [error_code: INVALID_RUNTIME\nmessage: \"Runtime \\\"nodejs22\\\" is not supported on GCF Gen1\"\n]"
    },
    "authenticationInfo": {
      "principalEmail": "[email protected]",
      "serviceAccountKeyName": "...",
      "principalSubject": "serviceAccount:[email protected]"
    },
    "requestMetadata": {
      "callerIp": "40.75.95.79",
      "callerSuppliedUserAgent": "FirebaseCLI/13.29.1,gzip(gfe),gzip(gfe)",
      "requestAttributes": {
        "time": "2024-12-14T11:08:18.672421Z",
        "auth": {}
      },
      "destinationAttributes": {}
    },
    "serviceName": "cloudfunctions.googleapis.com",
    "methodName": "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction",
    "authorizationInfo": [
      {
        "resource": "projects/ireceipt-pro/locations/us-central1/functions/triggers_auth_user_delete",
        "permission": "cloudfunctions.functions.update",
        "granted": true,
        "resourceAttributes": {},
        "permissionType": "ADMIN_WRITE"
      }
    ],
    "resourceName": "projects/ireceipt-pro/locations/us-central1/functions/triggers_auth_user_delete",
    "request": {
      "function": {
        "entryPoint": "triggers_auth_user_delete",
        "timeout": "60s",
        "name": "projects/ireceipt-pro/locations/us-central1/functions/triggers_auth_user_delete",
        "eventTrigger": {
          "resource": "projects/ireceipt-pro",
          "eventType": "providers/firebase.auth/eventTypes/user.delete"
        },
        "runtime": "nodejs22",
        "availableMemoryMb": 256,
        "labels": {
          "firebase-functions-hash": "b18866339b3181ec0aa270cdc97e69a4427c82f6",
          "deployment-tool": "cli-firebase"
        },
        "sourceUploadUrl": "...",
        "dockerRegistry": "ARTIFACT_REGISTRY"
      },
      "@type": "type.googleapis.com/google.cloud.functions.v1.UpdateFunctionRequest",
      "updateMask": "name,sourceUploadUrl,entryPoint,runtime,dockerRegistry,labels,eventTrigger.eventType,eventTrigger.resource,eventTrigger.failurePolicy,minInstances,maxInstances,ingressSettings,environmentVariables,serviceAccountEmail,availableMemoryMb,timeout,vpcConnector,vpcConnectorEgressSettings,sourceToken,buildEnvironmentVariables"
    },
    "resourceLocation": {
      "currentLocations": [
        "us-central1"
      ]
    }
  },
  "insertId": "mj9i9de25o2r",
  "resource": {
    "type": "cloud_function",
    "labels": {
      "region": "us-central1",
      "function_name": "triggers_auth_user_delete",
      "project_id": "ireceipt-pro"
    }
  },
  "timestamp": "2024-12-14T11:08:18.513711Z",
  "severity": "ERROR",
  "logName": "projects/ireceipt-pro/logs/cloudaudit.googleapis.com%2Factivity",
  "receiveTimestamp": "2024-12-14T11:08:19.081159810Z"
}

Were you able to successfully deploy your functions?

No, this requires rolling back the platform to node v20.

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@CorieW CorieW added Needs: Attention deploy Deployment related issues reproducible: yes Issue with a repro and removed needs-triage labels Dec 17, 2024
@seanblonien
Copy link

is there a workaround to change the runtime of a GCF Gen1 function to be node 20, while keeping the default for the project as node 22? or is the node version all or nothing change with the "engines" field

here is Firebase's documentation calling out that they specifically support both versions:

Note: Cloud Functions for Firebase (2nd gen) does not provide support for the events and triggers described in this guide. Because 1st gen and 2nd gen functions can coexist side-by-side in the same source file, you can still develop and deploy this functionality together with 2nd gen functions.

source

seemingly you CAN'T support both versions side-by-side if you choose to use Node 22, evidenced by this issue

@jwngr
Copy link

jwngr commented Dec 24, 2024

For those stuck on this, specify "nodejs20" as the Functions runtime in your firebase.json:

[
  "functions": [
    {
      "runtime": "nodejs20",
      // Other existing Functions config...
    }
  ],
  // Other existing firebase.json config...
]

You can find the relevant docs here.

For the Firebase team, it would be nice if the Gen1/2 Node versions moved in lockstep. Even better if Gen1 functions like the auth ones were just offered as Gen2 functions.

@kevin-induro
Copy link

@siarheidudko I had this same problem back in December. On a whim, I tried to deploy a v1 function with nodejs22 today, and it worked:
Image

I'd love verification from the Firebase team that this won't change again. This still doesn't indicate v1 support.

@davie-robertson
Copy link

@kevin-induro my functions/package.json and libraries are all built to use "engines": { "node": "22" } and written in typescript - all my cloud functions are V2 except auth functions and are deployed to europe-west1. I have not specified any runtime in firebase.json.

Where did you specify your version of node for it to deploy successfully?

@CorieW CorieW moved this from Needs Acknowledgment to Triaged in [Cloud] Extensions + Functions May 7, 2025
@cabljac cabljac added the triaged Triaged label May 7, 2025
@kevin-induro
Copy link

@davie-robertson The issue here is with V1 functions, so you'd only have an issue with the auth functions if you're having an issue.

That said, I've continued to not see an issue despite the referenced documentation still not saying that V1 supports 22.

To answer your question, The only change I've made is to update the engine in the package.json to 22.

@davie-robertson
Copy link

Thanks @kevin-induro , I am aware for the V1 auth support and the docs stating node 22 isn't supported, but my functions are not deploying as yours are - I can only guess it's a region issue.

i  functions: updating Node.js 22 (1st Gen) function createUserDocument(europe-west1)...
i  functions: updating Node.js 22 (1st Gen) function deleteUserDocument(europe-west1)...
⚠  functions: failed to update function projects/MyProject/locations/europe-west1/functions/createUserDocument

@davie-robertson
Copy link

the current behaviour also contradicts this https://cloud.google.com/functions/docs/release-notes
November 18, 2024
Cloud Run functions now supports the Node.js 22 runtime at the General Availability release level.

@davie-robertson
Copy link

and here's the real PITA, my function that won't deploy because it's using node 22, was previoulsy deployed using node 22:

firebase functions:delete createUserDocument --region=europe-west1 --force
i  functions: deleting Node.js 22 (1st Gen) function createUserDocument(europe-west1)...
✔  functions[createUserDocument(europe-west1)] Successful delete operation.
i  functions: cleaning up build files...

@isegal
Copy link

isegal commented May 16, 2025

We had an even more surprising behavior - deploys have been silently failing for us - firebase deploy runs successfully, gen1 functions on the web console are showing Node 22 runtime, but the actual deploy date and code is not updated. When running with --debug we see that there was an actual error:

Runtime validation errors: [error_code: INVALID_RUNTIME\nmessage: \"Runtime \\\"nodejs22\\\" is not supported on GCF Gen1\"\n]",
      "status": 400
    },
    "status": 400,
    "code": 400
  }

Even more bizzarre:
We print process.version to our logs in the code and it is showing v22.15.0

So the runtime somehow updated, but the code is not updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Deployment related issues Needs: Attention reproducible: yes Issue with a repro triaged Triaged
Projects
None yet
Development

No branches or pull requests

9 participants