From 26b97ba19b3996fc118e7a86f58841a059ae86c5 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Fri, 9 Dec 2022 16:14:38 -0800 Subject: [PATCH] Add support for nodejs18 (in preview). (#5319) --- CHANGELOG.md | 1 + schema/firebase-config.json | 6 ++++-- src/deploy/functions/runtimes/index.ts | 3 ++- .../functions/runtimes/node/parseRuntimeAndValidateSDK.ts | 1 + src/firebaseConfig.ts | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6149438f5a5..cc6969380cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,3 +3,4 @@ - Handle Next.js rewrites/redirects/headers incompatible with `firebase.json` in Cloud Functions (#5212) - Filter out Next.js prerendered routes that matches rewrites/redirects/headers rules from SSG content directory (#5212) - Warn if a web framework's package.json contains anything other than the framework default build command. +- Add support for nodejs18 for Cloud Functions for Firebase (#5319) diff --git a/schema/firebase-config.json b/schema/firebase-config.json index 6a20dd6d500..839508468e6 100644 --- a/schema/firebase-config.json +++ b/schema/firebase-config.json @@ -388,7 +388,8 @@ "nodejs10", "nodejs12", "nodejs14", - "nodejs16" + "nodejs16", + "nodejs18" ], "type": "string" }, @@ -442,7 +443,8 @@ "nodejs10", "nodejs12", "nodejs14", - "nodejs16" + "nodejs16", + "nodejs18" ], "type": "string" }, diff --git a/src/deploy/functions/runtimes/index.ts b/src/deploy/functions/runtimes/index.ts index 537d8141238..68bfb4125a0 100644 --- a/src/deploy/functions/runtimes/index.ts +++ b/src/deploy/functions/runtimes/index.ts @@ -5,7 +5,7 @@ import * as validate from "../validate"; import { FirebaseError } from "../../../error"; /** Supported runtimes for new Cloud Functions. */ -const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "nodejs16"]; +const RUNTIMES: string[] = ["nodejs10", "nodejs12", "nodejs14", "nodejs16", "nodejs18"]; // Experimental runtimes are part of the Runtime type, but are in a // different list to help guard against some day accidentally iterating over // and printing a hidden runtime to the user. @@ -33,6 +33,7 @@ const MESSAGE_FRIENDLY_RUNTIMES: Record = { nodejs12: "Node.js 12", nodejs14: "Node.js 14", nodejs16: "Node.js 16", + nodejs18: "Node.js 18", go113: "Go 1.13", }; diff --git a/src/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.ts b/src/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.ts index f1eeecefb6b..048d74f58ee 100644 --- a/src/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.ts +++ b/src/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.ts @@ -16,6 +16,7 @@ const ENGINE_RUNTIMES: Record