fix(cli): Derive debug port from server port#1460
Conversation
✅ Deploy Preview for cedarjs canceled.
|
Greptile SummaryThis PR fixes a real UX problem: when two Cedar apps run simultaneously on different ports, they previously both received Key changes:
Two issues to address before merging:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[devHandler resolves apiAvailablePort] --> B[getApiDebugFlag called with apiDebugPort and apiAvailablePort]
B --> C{apiDebugPort passed via CLI?}
C -- Yes --> D["--debug-port apiDebugPort"]
C -- No --> E{--apiDebugPort flag with no value?}
E -- Yes --> F["--debug-port '1'+apiAvailablePort e.g. 8911 to 18911"]
E -- No --> G[Read config api.debugPort from cedar.toml]
G --> H{debugPort value}
H -- number --> I["--debug-port debugPort"]
H -- false --> J["empty string - disabled"]
H -- undefined --> K["--debug-port '1'+apiAvailablePort default derivation"]
D --> L[Passed to nodemon exec command]
F --> L
I --> L
J --> L
K --> L
Reviews (1): Last reviewed commit: "fix(cli): Derive debug port from server ..." | Re-trigger Greptile |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 3m 34s | View ↗ |
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 2s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 10s | View ↗ |
nx run-many -t build |
✅ Succeeded | 5s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-03-25 11:56:15 UTC
|
The changes in this PR are now available on npm. Try them out by running |

If you try to simultaneously run two Cedar apps the second one won't start because the 8910 and 8911 ports are already taken.
So you go and update your cedar.toml file to run your second app on 8912 and 8913.
Now everything starts up just fine 🎉
The problem though is that they both launch with
--debug-port 18911. I noticed this when runningps aux | grep rw-First app, api side running on :8911

Second app, api side running on :8913

Notice how they both have the same debug port
This PR fixes this by adding '1' to the start of whatever port the dev server i running on.