Skip to content

fix: read the listen port from a bare host:port self endpoint - #36

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/listen-port-from-host-port
Sep 23, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/listen-port-from-host-port

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Problem. On hosted staging, every rendered solution (wiki/backend, lastlogin-go/backend) crash-loops at boot with:

panic: solution "wiki": unresolved listen port "": set PORT or ensure the SDK resolves this service's http endpoint

Codefly hands a service its own endpoint as a bare host:port. The render writes CODEFLY__ENDPOINT__WIKI__BACKEND__HTTP__HTTP: "localhost:8080", and every host service's self endpoint has the same form. loadConfig ran url.Parse on it, and Go reads localhost:8080 as scheme localhost with no port, so Port() is empty and validate() refuses.

Fix, at the owner. listenPort reads the port from either form: net.SplitHostPort for the bare address, url.Parse for a URL (what a local run supplies). PORT still wins when set.

Test. TestListenPortReadsEitherAddressForm covers the bare form, URLs, IPv6 and the empty and portless cases. go vet ./... and go test ./... pass.

🤖 Generated with Claude Code

Codefly hands a service its own endpoint as a bare host:port (a rendered cell
writes "localhost:8080"); url.Parse reads that as scheme "localhost" with no
port, so every rendered solution refused to boot with 'unresolved listen port
""'. listenPort accepts both the bare form and a URL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit d31403e into main Sep 23, 2026
1 check passed
@antoinetoussaint-byte
antoinetoussaint-byte deleted the fix/listen-port-from-host-port branch September 23, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant