diff --git a/CHANGELOG.md b/CHANGELOG.md index ba5bffdb110..19abf4027ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ - Released version 1.3.9 of the Data Connect emulator, which includes SDK support for `Any` scalar type and `OrderDirection`, support for `first` to lookup operations, and breaking changes for iOS generated SDKs. PLease see documentation for more details. +- Revert the minimum Functions SDK version and add logging for extensions features using v5.1.0 (#7731). diff --git a/src/deploy/functions/runtimes/node/index.ts b/src/deploy/functions/runtimes/node/index.ts index 7f65c75c4d7..2649e59821e 100644 --- a/src/deploy/functions/runtimes/node/index.ts +++ b/src/deploy/functions/runtimes/node/index.ts @@ -9,7 +9,12 @@ import fetch from "node-fetch"; import { FirebaseError } from "../../../../error"; import { getRuntimeChoice } from "./parseRuntimeAndValidateSDK"; import { logger } from "../../../../logger"; -import { logLabeledSuccess, logLabeledWarning, randomInt } from "../../../../utils"; +import { + logLabeledBullet, + logLabeledSuccess, + logLabeledWarning, + randomInt, +} from "../../../../utils"; import * as backend from "../../backend"; import * as build from "../../build"; import * as discovery from "../discovery"; @@ -20,7 +25,11 @@ import * as versioning from "./versioning"; import * as parseTriggers from "./parseTriggers"; import { fileExistsSync } from "../../../../fsutils"; -const MIN_FUNCTIONS_SDK_VERSION = "5.1.0"; +// The versions of the Firebase Functions SDK that added support for the container contract. +const MIN_FUNCTIONS_SDK_VERSION = "3.20.0"; + +// The version of the Firebase Functions SDK that added support for the extensions annotation in the container contract. +const MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES = "5.1.0"; /** * @@ -260,6 +269,15 @@ export class Delegate { ); return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env); } + // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property + // and log to the user explaining why they need to upgrade their version. + if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { + logLabeledBullet( + "functions", + `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + + `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, + ); + } let discovered = await discovery.detectFromYaml(this.sourceDir, this.projectId, this.runtime); if (!discovered) { const basePort = 8000 + randomInt(0, 1000); // Add a jitter to reduce likelihood of race condition