Skip to content

Commit

Permalink
Disable metadata service detection in the emulator. (#6860)
Browse files Browse the repository at this point in the history
* 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.

* changelog
  • Loading branch information
inlined committed Mar 10, 2024
1 parent 032f61c commit 71f3ef3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/emulator/functionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 71f3ef3

Please sign in to comment.