Skip to content

Commit 159d689

Browse files
authored
Remove protocol from DATA_CONNECT_EMULATOR_HOST. (#8396)
This unbreaks the Node.js Admin SDK who doesn't expect a protocol. The other env vars are unchanged for now but comments were added to clarify their use cases.
1 parent 14f50bb commit 159d689

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed a bug where the Admin SDK fails with ENOTFOUND when automatically connecting to the Data Connect emulator when run in the Functions emulator. (#8379)

src/emulator/env.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ export function setEnvVarsForEmulators(
4545
env[Constants.CLOUD_TASKS_EMULATOR_HOST] = host;
4646
break;
4747
case Emulators.DATACONNECT:
48+
// Right now, the JS SDK requires a protocol within the env var.
49+
// https://github.com/firebase/firebase-js-sdk/blob/88a8055808bdbd1c75011a94d11062460027d931/packages/data-connect/src/api/DataConnect.ts#L74
4850
env[Constants.FIREBASE_DATACONNECT_EMULATOR_HOST] = `http://${host}`;
49-
env[Constants.FIREBASE_DATACONNECT_ENV_ALT] = `http://${host}`;
50-
// Originally, there was a typo in this env var name. To avoid breaking folks unecessarily,
51-
// we'll keep setting this.
51+
// The alternative env var, right now only read by the Node.js Admin SDK, does not work if a protocol is appended.
52+
// https://github.com/firebase/firebase-admin-node/blob/a46086b61f58f07426a6ca103e00385ae216691d/src/data-connect/data-connect-api-client-internal.ts#L220
53+
env[Constants.FIREBASE_DATACONNECT_ENV_ALT] = host;
54+
// A previous CLI release set the following env var as well but it is missing an underscore between `DATA` and `CONNECT`.
55+
// We'll keep setting this for customers who depends on this misspelled name. Its value is also kept protocol-less.
5256
env["FIREBASE_DATACONNECT_EMULATOR_HOST"] = host;
5357
}
5458
}

0 commit comments

Comments
 (0)