ReviewOS

also looking at this

stacks/postline

fix(buddy): don't let optional rpx HTTPS preflight crash dev server

#3
Merged chris wants to merge fix/buddy-dev-rpx-crash into main
1 file +9 -0
9 days ago

./buddy dev printed stacks … starting… + the stx routes line, then exited (code 1) without ever logging the Frontend/API/Docs URLs.

Root cause

With a custom APP_URL (e.g. postline.localhost), the rpx TLS preflight (prepareRpxTlsForDev → ensureRpxDevelopmentHttps) is started early but only awaited later, inside the readiness handler that's gated behind the frontend port probe. The installed @stacksjs/rpx@0.11.8 doesn't export the TLS helpers that function calls (getRootCAPaths, certIncludesSanHostnames, readCertCommonName, verifyHttpsChain, isRootCaTrustedForSsl, trustRootCaForBrowsers), so it throws TypeError: getRootCAPaths is not a function. Because nothing is awaiting that promise yet, the rejection is unhandled and Bun kills the dev process — before the frontend binds :3000.

Fix

Attach a handler to rpxTlsPreflight immediately so an optional-proxy failure can never crash the dev server. The readiness handler still awaits it in a try/catch and prints HTTPS proxy unavailable, and dev degrades to http://localhost.

Verified

Before: exits code 1, :3000 never binds, no banner. After: stays up, frontend binds :3000, banner prints (Frontend/API/Docs + "ready in 1.6s"), with a clear ⚠ HTTPS proxy unavailable: getRootCAPaths is not a function → Use http://localhost:3000.

Note: HTTPS-via-rpx itself remains non-functional until @stacksjs/rpx is bumped to a build that ships those TLS helpers — tracked separately. This PR makes the failure non-fatal.

1 changed file on the files tab, with 0 review threads.

Sign in to comment on this pull request.