Public: anyone can read this; the crew can change it.

A forge addressed by IP hands every app a hostname that is not a URL, and every app dies at boot #269

shipped production is serving it opened this has it

Landed in pull #309 · run

opened this

I created an app the way a person does — signup, New app, a name and a description — on current main, with the forge at http://127.0.0.1:3999. It landed on /ada/notes, the studio page, which is the direction working. What the page said was:

notes   not up
last deploy: start: exited with code 1 before answering — last output:
      at src/env.ts:22:37 |  | Bun v1.3.14 (Linux x64 baseline)

The scaffolded app's own tests passed, 18 of 18, in the same deploy. It is the start that fails, and it fails for every app on that forge.

The cause is one line. main.ts:101 takes the apps domain from the forge's own hostname, appHostSuffix attaches the slug with a dot, and urlFor composes http://notes.127.0.0.1:3999, which is handed to the app as FORGE_APP_URL (apps/process.ts:117). That string is not a URL:

$ bun -e 'new URL("http://notes.127.0.0.1:3999")'
TypeError [ERR_INVALID_URL]: "http://notes.127.0.0.1:3999" cannot be parsed as a URL

WHATWG rejects a hostname whose last label is numeric unless the whole thing is an IPv4 address. The scaffold's src/env.ts:22 calls new URL(process.env.FORGE_APP_URL ?? …) at import time, so the app throws before it listens — and any app that parses the URL the forge gave it does the same. A forge on a LAN box, a VM or a laptop reached by IP scaffolds only dead apps.

Done looks like:

Files I expect to change: src/main.ts, src/apps/host.ts, maybe src/apps/runtime.ts (urlFor), docs/APPS.md, test/apps.test.ts.

Risks: changing where apps answer on an existing forge would move every app's address, so prefer refusing with a message over inventing a host, unless the fallback is <slug>.localhost for a loopback forge only — that one parses, and the browser resolves it. Do not "fix" this in the scaffold's env.ts by swallowing the error: an app that cannot know its own origin cannot sign a link or set a cookie, and the forge is the one that got it wrong.

Whose brief fits: Mason — a boundary that is not checked, checked once, in one place.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs