Skip to content

Commit 8ece698

Browse files
joehanmaneesht
andauthored
Set FIREBASE_DATA_CONNECT_EMUALTOR_HOSTinstead of FIREBASE_DATACONNECT_EMUALTOR_HOST (#8371)
* Fix typo in FIREBASE_DATA_CONNECT_EMULATOR_HOST and cleaned up error handling * Changelog * Update CHANGELOG.md Co-authored-by: Maneesh Tewani <maneesht@users.noreply.github.com> * Update src/emulator/env.ts Co-authored-by: Maneesh Tewani <maneesht@users.noreply.github.com> --------- Co-authored-by: Maneesh Tewani <maneesht@users.noreply.github.com>
1 parent f8ee66e commit 8ece698

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `apphosting:secrets:grantAccess` can now grant access to emails and can grant multiple secrets at once (#8357)
1212
- `apphosting:secrets:set` now has flows to help with test secrets (#8359)
1313
- Updated `init dataconnect` templates to `v1`.
14+
- Fixed a bug where the emulator suite would set `FIREBASE_DATACONNECT_EMULATOR_HOST` instead of `FIREBASE_DATA_CONNECT_EMULATOR_HOST`.
1415
- Fixed a bug in Auth emulator where accounts:lookup is case-sensitive for emails (#8344)
1516
- Fixed a bug where function deploys didn't support shorthand notation and parameterized service account (#8366)
1617
- Fixed an issue where `sql:setup` would incorrectly remove the `cloudsqlsuperuser` role from `firebasesuperuser` (#8363)

src/emulator/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class Constants {
7777
static FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST";
7878

7979
// Environment variable to discover the Data Connect emulator.
80-
static FIREBASE_DATACONNECT_EMULATOR_HOST = "FIREBASE_DATACONNECT_EMULATOR_HOST";
80+
static FIREBASE_DATACONNECT_EMULATOR_HOST = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
8181

8282
// Environment variable to override SDK/CLI to point at the Firebase Auth emulator.
8383
static FIREBASE_AUTH_EMULATOR_HOST = "FIREBASE_AUTH_EMULATOR_HOST";

src/emulator/dataconnect/pgliteServer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "./pg-gateway/index";
1818
import { fromNodeSocket } from "./pg-gateway/platforms/node";
1919
import { logger } from "../../logger";
20-
import { hasMessage } from "../../error";
20+
import { hasMessage, FirebaseError } from "../../error";
2121
import { StringDecoder } from "node:string_decoder";
2222

2323
export const TRUNCATE_TABLES_SQL = `
@@ -140,7 +140,8 @@ export class PostgresServer {
140140
const db = await PGlite.create(pgliteArgs);
141141
return db;
142142
}
143-
throw err;
143+
logger.debug(`Error from pglite: ${err}`);
144+
throw new FirebaseError("Unexpected error starting up Postgres.");
144145
}
145146
}
146147

src/emulator/env.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export function setEnvVarsForEmulators(
4545
env[Constants.CLOUD_TASKS_EMULATOR_HOST] = host;
4646
break;
4747
case Emulators.DATACONNECT:
48-
env[Constants.FIREBASE_DATACONNECT_EMULATOR_HOST] = host;
48+
env[Constants.FIREBASE_DATACONNECT_EMULATOR_HOST] = `http://${host}`;
49+
// Originally, there was a typo in this env var name. To avoid breaking folks unecessarily,
50+
// we'll keep setting this.
51+
env["FIREBASE_DATACONNECT_EMULATOR_HOST"] = host;
4952
}
5053
}
5154
}

0 commit comments

Comments
 (0)