-
Notifications
You must be signed in to change notification settings - Fork 0
fix(server): accept SERVER_PORT alias and fail fast on PORT/SERVER_PORT mismatch #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,7 +143,17 @@ const identifyActor: IdentifyActor = async (request) => { | |
| }; | ||
|
|
||
| const config = loadConfig(); | ||
| const port = Number.parseInt(process.env.PORT ?? "3001", 10); | ||
| const rawPort = process.env.PORT ?? process.env.SERVER_PORT ?? "3001"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: When Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** server/src/index.ts
**Line:** 146:146
**Comment:**
*Possible Bug: When `PORT` is empty and `SERVER_PORT` is valid, nullish coalescing selects the empty value, producing `NaN` instead of using the valid fallback.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Keep port selection aligned with the Vite proxy. When only 🤖 Prompt for AI Agents🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Treat empty environment values as unset.
🤖 Prompt for AI Agents |
||
| if ( | ||
| process.env.PORT && | ||
| process.env.SERVER_PORT && | ||
| process.env.PORT !== process.env.SERVER_PORT | ||
|
Comment on lines
+147
to
+150
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Equivalent numeric values such as Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** server/src/index.ts
**Line:** 147:150
**Comment:**
*Incorrect Condition Logic: Equivalent numeric values such as `03001` and `3001` are rejected as disagreement because the aliases are compared as raw strings.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix |
||
| ) { | ||
| throw new Error( | ||
| `PORT (${process.env.PORT}) and SERVER_PORT (${process.env.SERVER_PORT}) disagree: set one or set both to the same value`, | ||
| ); | ||
| } | ||
| const port = Number.parseInt(rawPort, 10); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Invalid or non-positive Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** server/src/index.ts
**Line:** 156:156
**Comment:**
*Type Error: Invalid or non-positive `SERVER_PORT` values become `NaN` or invalid numbers, then reach `serve`, causing startup failure instead of clear configuration handling.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix |
||
| const database = createDatabase(config.databaseUrl); | ||
| await initializeDevActorUser(database, config.singleUser); | ||
| // The vault, built before the agent store because a customer's agent may sit behind a key and that | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the example match the one-edit instruction.
The example keeps
PORT=3001andSERVER_PORT=3001active on Lines 19-20. If a user edits only one line, the mismatch check rejects the configuration. This contradicts “a single edit is enough” on Lines 12-13. Keep one variable active and comment the alias, or instruct users to update both values together.🤖 Prompt for AI Agents