Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/server/src/persistence/Layers/Sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Loader = {
layer: (config: RuntimeSqliteLayerConfig) => Layer.Layer<SqlClient.SqlClient>;
};
const defaultSqliteClientLoaders = {
bun: () => import("@effect/sql-sqlite-bun/SqliteClient"),
bun: () => import("../NodeSqliteClient.ts"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use Bun-compatible SQLite client for bun runtime

Changing the bun loader to ../NodeSqliteClient.ts makes Bun executions take the Node path that imports node:sqlite, which is not available in Bun, so the server can fail at startup in the default Bun dev flow (apps/server uses bun run src/bin.ts). This is a runtime regression introduced by this commit: previously the Bun branch loaded @effect/sql-sqlite-bun/SqliteClient, which is the Bun-targeted client.

Useful? React with 👍 / 👎.

node: () => import("../NodeSqliteClient.ts"),
} satisfies Record<string, () => Promise<Loader>>;

Expand Down Expand Up @@ -43,20 +43,20 @@ export const makeSqlitePersistenceLive = Effect.fn("makeSqlitePersistenceLive")(
yield* fs.makeDirectory(path.dirname(dbPath), { recursive: true });

return Layer.provideMerge(
setup,
makeRuntimeSqliteLayer({
filename: dbPath,
spanAttributes: {
"db.name": path.basename(dbPath),
"service.name": "t3-server",
},
}),
setup,
);
}, Layer.unwrap);

export const SqlitePersistenceMemory = Layer.provideMerge(
setup,
makeRuntimeSqliteLayer({ filename: ":memory:" }),
setup,
);

export const layerConfig = Layer.unwrap(
Expand Down