Skip to content

Commit e3b386d

Browse files
committed
Fix typo in FIREBASE_DATA_CONNECT_EMULATOR_HOST and cleaned up error handling
1 parent 7874651 commit e3b386d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/emulator/constants.ts

+1-1
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

+3-2
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

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export function setEnvVarsForEmulators(
4646
break;
4747
case Emulators.DATACONNECT:
4848
env[Constants.FIREBASE_DATACONNECT_EMULATOR_HOST] = 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)