From a873e2db5d53d85005d32a98a12d2bc2d2eb4736 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 28 Oct 2025 21:24:19 -0700 Subject: [PATCH 1/2] fix(emulator): skip legacy monkeypatching for firebase-functions v7+ Detects `firebase-functions` v7+ in the emulator runtime and skips legacy stubs and config helpers that are incompatible with the new SDK version, preserving backward compatibility for older versions. --- src/emulator/functionsEmulatorRuntime.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/emulator/functionsEmulatorRuntime.ts b/src/emulator/functionsEmulatorRuntime.ts index 8720c3b08ab..3049b5d8ef8 100644 --- a/src/emulator/functionsEmulatorRuntime.ts +++ b/src/emulator/functionsEmulatorRuntime.ts @@ -400,6 +400,11 @@ https://github.com/firebase/firebase-functions/blob/9e3bda13565454543b4c7b2fd10f */ async function initializeFirebaseFunctionsStubs(): Promise { const firebaseFunctionsResolution = await assertResolveDeveloperNodeModule("firebase-functions"); + if (compareVersionStrings(firebaseFunctionsResolution.version, "7.0.0") >= 0) { + logDebug("Detected firebase-functions v7+, skipping legacy stubs."); + return; + } + const firebaseFunctionsRoot = findModuleRoot( "firebase-functions", firebaseFunctionsResolution.resolution, @@ -711,6 +716,11 @@ function warnAboutStorageProd(): void { async function initializeFunctionsConfigHelper(): Promise { const functionsResolution = await assertResolveDeveloperNodeModule("firebase-functions"); + if (compareVersionStrings(functionsResolution.version, "7.0.0") >= 0) { + logDebug("Detected firebase-functions v7+, skipping config helper."); + return; + } + const localFunctionsModule = require(functionsResolution.resolution); logDebug("Checked functions.config()", { From 1063da8a1fce7aa0cf223c3462761e04cb5a6fd6 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 28 Oct 2025 21:25:34 -0700 Subject: [PATCH 2/2] docs: add changelog entry for #9401 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ee3d69a119..c62d9e3cb78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fixed an issue where the emulator would fail to start when using `firebase-functions` v7+ (#9401). - Added `functions.list_functions` as a MCP tool (#9369) - Added AI Logic to `firebase init` CLI command and `firebase_init` MCP tool. (#9185) - Improved error messages for Firebase AI Logic provisioning during 'firebase init' (#9377)