Skip to content
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

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

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

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.

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
Projects
None yet
Development

No branches or pull requests

5 participants