From 7cd90499d63fc4b39239f48155b9023f955830ab Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:49:55 +0000 Subject: [PATCH] feat: Update firebase-functions imports to remove /v2 This commit updates all Node.js samples in the /Node directory to use the new default firebase-functions imports. All instances of `firebase-functions/v2/*` have been replaced with `firebase-functions/*`. --- Node/alerts-to-discord/functions/index.js | 6 +++--- Node/app-distribution-feedback-to-jira/functions/index.js | 2 +- Node/call-vertex-remote-config-server/functions/index.js | 2 +- Node/delete-unused-accounts-cron/functions/index.js | 2 +- Node/fcm-notifications/functions/index.js | 2 +- Node/instrument-with-opentelemetry/functions/index.js | 2 +- Node/quickstarts/auth-blocking-functions/functions/index.js | 2 +- .../callable-functions-streaming/functions/index.js | 2 +- Node/quickstarts/callable-functions/functions/index.js | 4 ++-- Node/quickstarts/custom-events/functions/index.js | 2 +- Node/quickstarts/firestore-sync-auth/functions/index.js | 2 +- Node/quickstarts/genkit-helloworld/functions/index.js | 2 +- Node/quickstarts/https-time-server/functions/index.js | 2 +- Node/quickstarts/monitor-cloud-logging/functions/index.js | 4 ++-- Node/quickstarts/pubsub-helloworld/functions/index.js | 2 +- .../quickstarts/testlab-matrix-completed/functions/index.js | 2 +- Node/quickstarts/thumbnails/functions/index.js | 2 +- Node/quickstarts/uppercase-firestore/functions/index.js | 4 ++-- Node/quickstarts/uppercase-rtdb/functions/index.js | 4 ++-- Node/remote-config-diff/functions/index.js | 2 +- Node/remote-config-server-with-vertex/functions/index.js | 2 +- Node/taskqueues-backup-images/functions/index.js | 6 +++--- Node/test-functions-jest-ts/functions/src/index.ts | 2 +- Node/test-functions-jest/functions/index.js | 2 +- Node/test-functions-mocha/functions/index.js | 2 +- Node/testlab-to-slack/functions/index.js | 2 +- 26 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Node/alerts-to-discord/functions/index.js b/Node/alerts-to-discord/functions/index.js index a6d2f48a35..59626a055e 100644 --- a/Node/alerts-to-discord/functions/index.js +++ b/Node/alerts-to-discord/functions/index.js @@ -17,13 +17,13 @@ const { onNewFatalIssuePublished, -} = require("firebase-functions/v2/alerts/crashlytics"); +} = require("firebase-functions/alerts/crashlytics"); const { onNewTesterIosDevicePublished, -} = require("firebase-functions/v2/alerts/appDistribution"); +} = require("firebase-functions/alerts/appDistribution"); const { onThresholdAlertPublished, -} = require("firebase-functions/v2/alerts/performance"); +} = require("firebase-functions/alerts/performance"); const logger = require("firebase-functions/logger"); // [END v2import] diff --git a/Node/app-distribution-feedback-to-jira/functions/index.js b/Node/app-distribution-feedback-to-jira/functions/index.js index be577f4858..d335a9513e 100644 --- a/Node/app-distribution-feedback-to-jira/functions/index.js +++ b/Node/app-distribution-feedback-to-jira/functions/index.js @@ -15,7 +15,7 @@ */ import { - onInAppFeedbackPublished} from "firebase-functions/v2/alerts/appDistribution"; + onInAppFeedbackPublished} from "firebase-functions/alerts/appDistribution"; import {defineInt, defineSecret, defineString} from "firebase-functions/params"; import logger from "firebase-functions/logger"; import fetch from "node-fetch"; diff --git a/Node/call-vertex-remote-config-server/functions/index.js b/Node/call-vertex-remote-config-server/functions/index.js index 9cf167572a..809c74384d 100644 --- a/Node/call-vertex-remote-config-server/functions/index.js +++ b/Node/call-vertex-remote-config-server/functions/index.js @@ -16,7 +16,7 @@ */ // [START remote_config_server_vertex_init] -const { onCall, HttpsError } = require("firebase-functions/v2/https"); +const { onCall, HttpsError } = require("firebase-functions/https"); const logger = require("firebase-functions/logger"); const { initializeApp } = require("firebase-admin/app"); diff --git a/Node/delete-unused-accounts-cron/functions/index.js b/Node/delete-unused-accounts-cron/functions/index.js index 063a3ec96c..837735a065 100644 --- a/Node/delete-unused-accounts-cron/functions/index.js +++ b/Node/delete-unused-accounts-cron/functions/index.js @@ -18,7 +18,7 @@ // [START all] // [START import] // The Cloud Functions for Firebase SDK to set up triggers and logging. -const {onSchedule} = require("firebase-functions/v2/scheduler"); +const {onSchedule} = require("firebase-functions/scheduler"); const {logger} = require("firebase-functions"); // The Firebase Admin SDK to delete inactive users. diff --git a/Node/fcm-notifications/functions/index.js b/Node/fcm-notifications/functions/index.js index 8c38ab846d..cae15baeae 100644 --- a/Node/fcm-notifications/functions/index.js +++ b/Node/fcm-notifications/functions/index.js @@ -19,7 +19,7 @@ import {getAuth} from "firebase-admin/auth"; import {getDatabase} from "firebase-admin/database"; import {getMessaging} from "firebase-admin/messaging"; import {log, warn} from "firebase-functions/logger"; -import {onValueWritten} from "firebase-functions/v2/database"; +import {onValueWritten} from "firebase-functions/database"; initializeApp(); const auth = getAuth(); diff --git a/Node/instrument-with-opentelemetry/functions/index.js b/Node/instrument-with-opentelemetry/functions/index.js index 6902f3c6ab..b978fbefc9 100644 --- a/Node/instrument-with-opentelemetry/functions/index.js +++ b/Node/instrument-with-opentelemetry/functions/index.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const {onCall} = require("firebase-functions/v2/https"); +const {onCall} = require("firebase-functions/https"); const logger = require("firebase-functions/logger"); const {initializeApp} = require("firebase-admin/app"); const {getFirestore} = require("firebase-admin/firestore"); diff --git a/Node/quickstarts/auth-blocking-functions/functions/index.js b/Node/quickstarts/auth-blocking-functions/functions/index.js index 1ab390fdd4..d6ef1c4beb 100644 --- a/Node/quickstarts/auth-blocking-functions/functions/index.js +++ b/Node/quickstarts/auth-blocking-functions/functions/index.js @@ -18,7 +18,7 @@ const { beforeUserCreated, beforeUserSignedIn, HttpsError, -} = require("firebase-functions/v2/identity"); +} = require("firebase-functions/identity"); const {admin} = require("firebase-admin"); admin.initializeApp(); diff --git a/Node/quickstarts/callable-functions-streaming/functions/index.js b/Node/quickstarts/callable-functions-streaming/functions/index.js index f83d070fb1..cef512467d 100644 --- a/Node/quickstarts/callable-functions-streaming/functions/index.js +++ b/Node/quickstarts/callable-functions-streaming/functions/index.js @@ -16,7 +16,7 @@ // [START full-sample] // Dependencies for callable functions. -const {onCall, HttpsError} = require("firebase-functions/v2/https"); +const {onCall, HttpsError} = require("firebase-functions/https"); /** * Gets the weather from the national weather service diff --git a/Node/quickstarts/callable-functions/functions/index.js b/Node/quickstarts/callable-functions/functions/index.js index dddfd0f763..c208aff712 100644 --- a/Node/quickstarts/callable-functions/functions/index.js +++ b/Node/quickstarts/callable-functions/functions/index.js @@ -16,8 +16,8 @@ // [START imports] // Dependencies for callable functions. -const {onCall, HttpsError} = require("firebase-functions/v2/https"); -const {logger} = require("firebase-functions/v2"); +const {onCall, HttpsError} = require("firebase-functions/https"); +const {logger} = require("firebase-functions"); // Dependencies for the addMessage function. const {getDatabase} = require("firebase-admin/database"); diff --git a/Node/quickstarts/custom-events/functions/index.js b/Node/quickstarts/custom-events/functions/index.js index 5123c310ee..ea959e2d38 100644 --- a/Node/quickstarts/custom-events/functions/index.js +++ b/Node/quickstarts/custom-events/functions/index.js @@ -15,7 +15,7 @@ */ // [START import] -const {onCustomEventPublished} = require("firebase-functions/v2/eventarc"); +const {onCustomEventPublished} = require("firebase-functions/eventarc"); const logger = require("firebase-functions/logger"); const {initializeApp} = require("firebase-admin/app"); const {getFirestore} = require("firebase-admin/firestore"); diff --git a/Node/quickstarts/firestore-sync-auth/functions/index.js b/Node/quickstarts/firestore-sync-auth/functions/index.js index 50096532d3..bcd3473fb7 100644 --- a/Node/quickstarts/firestore-sync-auth/functions/index.js +++ b/Node/quickstarts/firestore-sync-auth/functions/index.js @@ -20,7 +20,7 @@ // The Cloud Functions for Firebase SDK to create Cloud Functions and triggers. const { onDocumentWrittenWithAuthContext, -} = require("firebase-functions/v2/firestore"); +} = require("firebase-functions/firestore"); const {logger} = require("firebase-functions"); exports.verifyComment = onDocumentWrittenWithAuthContext( diff --git a/Node/quickstarts/genkit-helloworld/functions/index.js b/Node/quickstarts/genkit-helloworld/functions/index.js index c6b948f8e3..b00326122a 100644 --- a/Node/quickstarts/genkit-helloworld/functions/index.js +++ b/Node/quickstarts/genkit-helloworld/functions/index.js @@ -17,7 +17,7 @@ // [START complete-example] // [START imports] // [START import-trigger] -const {onCallGenkit} = require("firebase-functions/v2/https"); +const {onCallGenkit} = require("firebase-functions/https"); // [END import-trigger] // [START import-params] const {defineSecret} = require("firebase-functions/params"); diff --git a/Node/quickstarts/https-time-server/functions/index.js b/Node/quickstarts/https-time-server/functions/index.js index 825e2a38c4..4a22df68a2 100644 --- a/Node/quickstarts/https-time-server/functions/index.js +++ b/Node/quickstarts/https-time-server/functions/index.js @@ -16,7 +16,7 @@ "use strict"; // [START v2httpImport] -const {onRequest} = require("firebase-functions/v2/https"); +const {onRequest} = require("firebase-functions/https"); // [END v2httpImport] // [START v2httpAdditionalImports] diff --git a/Node/quickstarts/monitor-cloud-logging/functions/index.js b/Node/quickstarts/monitor-cloud-logging/functions/index.js index d9558ff164..6314bb0e40 100644 --- a/Node/quickstarts/monitor-cloud-logging/functions/index.js +++ b/Node/quickstarts/monitor-cloud-logging/functions/index.js @@ -14,10 +14,10 @@ * limitations under the License. */ -const {onRequest} = require("firebase-functions/v2/https"); +const {onRequest} = require("firebase-functions/https"); const { onRegressionAlertPublished, -} = require("firebase-functions/v2/alerts/crashlytics"); +} = require("firebase-functions/alerts/crashlytics"); // [START loggerImport] // All available logging functions diff --git a/Node/quickstarts/pubsub-helloworld/functions/index.js b/Node/quickstarts/pubsub-helloworld/functions/index.js index 482dab83d9..0bb3d48181 100644 --- a/Node/quickstarts/pubsub-helloworld/functions/index.js +++ b/Node/quickstarts/pubsub-helloworld/functions/index.js @@ -16,7 +16,7 @@ "use strict"; // [START v2import] -const {onMessagePublished} = require("firebase-functions/v2/pubsub"); +const {onMessagePublished} = require("firebase-functions/pubsub"); const logger = require("firebase-functions/logger"); // [END v2import] diff --git a/Node/quickstarts/testlab-matrix-completed/functions/index.js b/Node/quickstarts/testlab-matrix-completed/functions/index.js index 4774e07c2c..ac5992b411 100644 --- a/Node/quickstarts/testlab-matrix-completed/functions/index.js +++ b/Node/quickstarts/testlab-matrix-completed/functions/index.js @@ -18,7 +18,7 @@ // [START all] // [START import] // The Cloud Functions for Firebase SDK to set up triggers and logging. -const {onTestMatrixCompleted} = require("firebase-functions/v2/testLab"); +const {onTestMatrixCompleted} = require("firebase-functions/testLab"); const {logger} = require("firebase-functions"); // [END import] diff --git a/Node/quickstarts/thumbnails/functions/index.js b/Node/quickstarts/thumbnails/functions/index.js index c8dc4477c9..d657dddd2b 100644 --- a/Node/quickstarts/thumbnails/functions/index.js +++ b/Node/quickstarts/thumbnails/functions/index.js @@ -17,7 +17,7 @@ // [START v2storageImports] // [START v2storageSDKImport] -const {onObjectFinalized} = require("firebase-functions/v2/storage"); +const {onObjectFinalized} = require("firebase-functions/storage"); // [END v2storageSDKImport] // [START v2storageAdditionalImports] diff --git a/Node/quickstarts/uppercase-firestore/functions/index.js b/Node/quickstarts/uppercase-firestore/functions/index.js index 6342af285b..c1e2fa762d 100644 --- a/Node/quickstarts/uppercase-firestore/functions/index.js +++ b/Node/quickstarts/uppercase-firestore/functions/index.js @@ -19,8 +19,8 @@ // [START import] // The Cloud Functions for Firebase SDK to create Cloud Functions and triggers. const {logger} = require("firebase-functions"); -const {onRequest} = require("firebase-functions/v2/https"); -const {onDocumentCreated} = require("firebase-functions/v2/firestore"); +const {onRequest} = require("firebase-functions/https"); +const {onDocumentCreated} = require("firebase-functions/firestore"); // The Firebase Admin SDK to access Firestore. const {initializeApp} = require("firebase-admin/app"); diff --git a/Node/quickstarts/uppercase-rtdb/functions/index.js b/Node/quickstarts/uppercase-rtdb/functions/index.js index 5db5125ab0..2ef1ef91d6 100644 --- a/Node/quickstarts/uppercase-rtdb/functions/index.js +++ b/Node/quickstarts/uppercase-rtdb/functions/index.js @@ -18,8 +18,8 @@ // [START all] // [START import] // The Cloud Functions for Firebase SDK to setup triggers and logging. -const {onRequest} = require("firebase-functions/v2/https"); -const {onValueCreated} = require("firebase-functions/v2/database"); +const {onRequest} = require("firebase-functions/https"); +const {onValueCreated} = require("firebase-functions/database"); const {logger} = require("firebase-functions"); // The Firebase Admin SDK to access the Firebase Realtime Database. diff --git a/Node/remote-config-diff/functions/index.js b/Node/remote-config-diff/functions/index.js index 88ef06b258..bd26b31981 100644 --- a/Node/remote-config-diff/functions/index.js +++ b/Node/remote-config-diff/functions/index.js @@ -18,7 +18,7 @@ // [START all] // [START import] // The Cloud Functions for Firebase SDK to set up triggers and logging. -const {onConfigUpdated} = require("firebase-functions/v2/remoteConfig"); +const {onConfigUpdated} = require("firebase-functions/remoteConfig"); const logger = require("firebase-functions/logger"); // The Firebase Admin SDK to obtain access tokens. const admin = require("firebase-admin"); diff --git a/Node/remote-config-server-with-vertex/functions/index.js b/Node/remote-config-server-with-vertex/functions/index.js index 570e786b91..19e1c0e747 100644 --- a/Node/remote-config-server-with-vertex/functions/index.js +++ b/Node/remote-config-server-with-vertex/functions/index.js @@ -1,5 +1,5 @@ // [START remote_config_server_vertex_init] -const { onRequest } = require("firebase-functions/v2/https"); +const { onRequest } = require("firebase-functions/https"); const logger = require("firebase-functions/logger"); const { initializeApp } = require("firebase-admin/app"); diff --git a/Node/taskqueues-backup-images/functions/index.js b/Node/taskqueues-backup-images/functions/index.js index 5a70019aa4..51675820f8 100644 --- a/Node/taskqueues-backup-images/functions/index.js +++ b/Node/taskqueues-backup-images/functions/index.js @@ -16,10 +16,10 @@ "use strict"; // [START imports] // Dependencies for task queue functions. -const {onTaskDispatched} = require("firebase-functions/v2/tasks"); -const {onRequest, HttpsError} = require("firebase-functions/v2/https"); +const {onTaskDispatched} = require("firebase-functions/tasks"); +const {onRequest, HttpsError} = require("firebase-functions/https"); const {getFunctions} = require("firebase-admin/functions"); -const {logger} = require("firebase-functions/v2"); +const {logger} = require("firebase-functions"); // Dependencies for image backup. const path = require("path"); diff --git a/Node/test-functions-jest-ts/functions/src/index.ts b/Node/test-functions-jest-ts/functions/src/index.ts index 09ca40d683..60343f7759 100644 --- a/Node/test-functions-jest-ts/functions/src/index.ts +++ b/Node/test-functions-jest-ts/functions/src/index.ts @@ -15,7 +15,7 @@ */ import {logger} from "firebase-functions"; -import {onObjectFinalized} from "firebase-functions/v2/storage"; +import {onObjectFinalized} from "firebase-functions/storage"; export const logstore = onObjectFinalized("my-bucket", (cloudEvent) => { logger.log(cloudEvent); diff --git a/Node/test-functions-jest/functions/index.js b/Node/test-functions-jest/functions/index.js index e938f94272..74957fad5f 100644 --- a/Node/test-functions-jest/functions/index.js +++ b/Node/test-functions-jest/functions/index.js @@ -15,7 +15,7 @@ */ const {logger} = require("firebase-functions"); -const {onObjectFinalized} = require("firebase-functions/v2/storage"); +const {onObjectFinalized} = require("firebase-functions/storage"); exports.logstore = onObjectFinalized("my-bucket", (cloudEvent) => { logger.log(cloudEvent); diff --git a/Node/test-functions-mocha/functions/index.js b/Node/test-functions-mocha/functions/index.js index e938f94272..74957fad5f 100644 --- a/Node/test-functions-mocha/functions/index.js +++ b/Node/test-functions-mocha/functions/index.js @@ -15,7 +15,7 @@ */ const {logger} = require("firebase-functions"); -const {onObjectFinalized} = require("firebase-functions/v2/storage"); +const {onObjectFinalized} = require("firebase-functions/storage"); exports.logstore = onObjectFinalized("my-bucket", (cloudEvent) => { logger.log(cloudEvent); diff --git a/Node/testlab-to-slack/functions/index.js b/Node/testlab-to-slack/functions/index.js index 9da070d1e7..ec4c650152 100644 --- a/Node/testlab-to-slack/functions/index.js +++ b/Node/testlab-to-slack/functions/index.js @@ -18,7 +18,7 @@ // [START all] // [START import] // The Cloud Functions for Firebase SDK to set up triggers and logging. -const {onTestMatrixCompleted} = require("firebase-functions/v2/testLab"); +const {onTestMatrixCompleted} = require("firebase-functions/testLab"); const {logger} = require("firebase-functions"); // The node-fetch library to send web requests to Slack. const fetch = require("node-fetch");