Skip to content

Commit 4214f18

Browse files
committed
chore: remove deprecated functions.config() monkey patching.
1 parent 9903737 commit 4214f18

File tree

1 file changed

+0
-43
lines changed

1 file changed

+0
-43
lines changed

src/emulator/functionsEmulatorRuntime.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -709,48 +709,6 @@ function warnAboutStorageProd(): void {
709709
).log();
710710
}
711711

712-
async function initializeFunctionsConfigHelper(): Promise<void> {
713-
const functionsResolution = await assertResolveDeveloperNodeModule("firebase-functions");
714-
const localFunctionsModule = require(functionsResolution.resolution);
715-
716-
logDebug("Checked functions.config()", {
717-
config: localFunctionsModule.config(),
718-
});
719-
720-
const originalConfig = localFunctionsModule.config();
721-
const proxiedConfig = new Proxied(originalConfig)
722-
.any((parentConfig, parentKey) => {
723-
const isInternal = parentKey.startsWith("Symbol(") || parentKey.startsWith("inspect");
724-
if (!parentConfig[parentKey] && !isInternal) {
725-
new EmulatorLog("SYSTEM", "functions-config-missing-value", "", {
726-
key: parentKey,
727-
}).log();
728-
}
729-
730-
return parentConfig[parentKey];
731-
})
732-
.finalize();
733-
734-
const functionsModuleProxy = new Proxied<typeof localFunctionsModule>(localFunctionsModule);
735-
const proxiedFunctionsModule = functionsModuleProxy
736-
.when("config", () => () => {
737-
return proxiedConfig;
738-
})
739-
.finalize();
740-
741-
// Stub the functions module in the require cache
742-
const v = require.cache[functionsResolution.resolution];
743-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- this is not precedent.
744-
require.cache[functionsResolution.resolution] = Object.assign(v!, {
745-
exports: proxiedFunctionsModule,
746-
path: path.dirname(functionsResolution.resolution),
747-
});
748-
749-
logDebug("firebase-functions has been stubbed.", {
750-
functionsResolution,
751-
});
752-
}
753-
754712
/*
755713
Retains a reference to the raw body buffer to allow access to the raw body for things like request
756714
signature validation. This is used as the "verify" function in body-parser options.
@@ -899,7 +857,6 @@ async function initializeRuntime(): Promise<void> {
899857

900858
initializeRuntimeConfig();
901859
initializeNetworkFiltering();
902-
await initializeFunctionsConfigHelper();
903860
await initializeFirebaseFunctionsStubs();
904861
await initializeFirebaseAdminStubs();
905862
}

0 commit comments

Comments
 (0)