Skip to content

Commit 47914ef

Browse files
committed
fix(api): bind to port 3001 when dev skips env validation defaults
1 parent a1a0ff7 commit 47914ef

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.1",
55
"type": "module",
66
"scripts": {
7-
"dev": "NODE_ENV=development dotenv -- bun --hot src/index.ts --port 3001",
7+
"dev": "NODE_ENV=development dotenv -- bun --hot src/index.ts",
88
"test": "TZ=UTC bunx --bun vitest run",
99
"test:integration": "TZ=UTC bunx --bun vitest run --config vitest.integration.config.ts",
1010
"test:watch": "TZ=UTC bunx --bun vitest"

apps/api/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ registerShutdownHooks();
109109

110110
export default {
111111
fetch: app.fetch,
112-
port: Number.parseInt(apiEnv.PORT, 10),
112+
// In development env validation is skipped, so zod defaults never apply and
113+
// apiEnv.PORT can be undefined — fall back explicitly or Bun binds a random port.
114+
port: Number.parseInt(apiEnv.PORT ?? "3001", 10) || 3001,
113115
idleTimeout: BUN_IDLE_TIMEOUT_SECONDS,
114116
};

0 commit comments

Comments
 (0)