Skip to content

Commit 324c680

Browse files
joehanmaneesht
andauthored
Use correct import path for data connect emulator (#8220)
* Use correct import path for data connect emulator * Actually fix it this time * fix the thing i broke and format * Update src/emulator/dataconnect/pgliteServer.ts Co-authored-by: Maneesh Tewani <[email protected]> --------- Co-authored-by: Maneesh Tewani <[email protected]>
1 parent ed3bde4 commit 324c680

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed an issue where `--import` path was incorrectly resolved for the Data Connect emulator. (#8219)

src/emulator/dataconnect/pgliteServer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ export class PostgresServer {
8989

9090
async getDb(): Promise<PGlite> {
9191
if (!this.db) {
92+
// First, ensure that the data directory exists - PGLite tries to do this but doesn't do so recursively
93+
if (this.dataDirectory && !fs.existsSync(this.dataDirectory)) {
94+
fs.mkdirSync(this.dataDirectory, { recursive: true });
95+
}
9296
// Not all schemas will need vector installed, but we don't have an good way
9397
// to swap extensions after starting PGLite, so we always include it.
9498
const vector = (await dynamicImport("@electric-sql/pglite/vector")).vector;

src/emulator/dataconnectEmulator.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export class DataConnectEmulator implements EmulatorInstance {
7373
let resolvedConfigDir;
7474
try {
7575
resolvedConfigDir = this.args.config.path(this.args.configDir);
76-
7776
const info = await DataConnectEmulator.build({ configDir: resolvedConfigDir });
7877
if (requiresVector(info.metadata)) {
7978
if (Constants.isDemoProject(this.args.projectId)) {
@@ -125,7 +124,7 @@ export class DataConnectEmulator implements EmulatorInstance {
125124
dataDirectory = this.args.config.path(dataDirectory);
126125
}
127126
const postgresDumpPath = this.args.importPath
128-
? path.join(this.args.config.path(this.args.importPath), "postgres.tar.gz")
127+
? path.join(this.args.importPath, "postgres.tar.gz")
129128
: undefined;
130129
this.postgresServer = new PostgresServer({
131130
dataDirectory,

0 commit comments

Comments
 (0)