From b83d7a5d5d81968fde337cccca846a461978168b Mon Sep 17 00:00:00 2001 From: Thomas Bouldin Date: Fri, 8 Mar 2024 11:46:16 -0800 Subject: [PATCH 1/2] Disable metadata service detection in the emulator. Fix for #6765. The latest version of google-gax attempts to read from the metadata server (on an internal IP address). Setting the environment variable METADATA_SERVER_DETECTION=none by default will turn this behavior off. This is overridable with .env.local. --- src/emulator/functionsEmulator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emulator/functionsEmulator.ts b/src/emulator/functionsEmulator.ts index d83e8c23f74..0cb50c96588 100644 --- a/src/emulator/functionsEmulator.ts +++ b/src/emulator/functionsEmulator.ts @@ -1349,6 +1349,7 @@ export class FunctionsEmulator implements EmulatorInstance { cwd: backend.functionsDir, env: { node: backend.bin, + METADATA_SERVER_DETECTION: "none", ...process.env, ...envs, PORT: socketPath, @@ -1451,7 +1452,6 @@ export class FunctionsEmulator implements EmulatorInstance { /** * Gets the address of a running emulator, either from explicit args or by * consulting the emulator registry. - * * @param emulator */ private getEmulatorInfo(emulator: Emulators): EmulatorInfo | undefined { From e4d2be1b4c6555a1416ea7dfdc6bd138e0627d0b Mon Sep 17 00:00:00 2001 From: Thomas Bouldin Date: Fri, 8 Mar 2024 11:50:54 -0800 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb2d..d91940bddbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +Inject an environment variable in the node functions emulator to tell the google-gax SDK not to look for the metadata service. (#6860)