chore(repo): allow PORT and UI_PORT overrides for sandbox dev servers#8673
Conversation
Two coupled issues prevented overriding the sandbox dev server ports:
1. Turbo 2.x runs in strict env mode by default, so env vars not listed
in globalEnv/globalPassThroughEnv never reach package scripts. PORT
and UI_PORT were both being filtered out before clerk-js and @clerk/ui
could see them. Added both to globalPassThroughEnv.
2. The @clerk/ui sandbox serve script and the clerk-js sandbox template's
uiScriptUrl were both hardcoded to localhost:4011. Parameterized with
UI_PORT (defaulting to 4011) so PORT/UI_PORT can be set independently
when running multiple sandboxes in parallel.
After this change:
PORT=4001 UI_PORT=4012 pnpm dev:sandbox
starts clerk-js on 4001 and @clerk/ui on 4012, with the sandbox template
loading ui.browser.js from the matching UI_PORT.
🦋 Changeset detectedLatest commit: 0e53798 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Snapi: no API changes detected in |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR introduces environment variable configurability for the UI port in the sandbox development setup. The Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
Summary
Sandbox dev servers couldn't honor
PORTorUI_PORTenv overrides because of two coupled gaps:globalEnv/globalPassThroughEnv, soPORTandUI_PORTnever reached the package scripts.@clerk/ui'sdev:sandbox:serveand the clerk-js sandbox template'suiScriptUrlwere hardcoded tolocalhost:4011.After this PR:
starts clerk-js on
4001and@clerk/uion4012, and the sandbox template loadsui.browser.jsfrom the matchingUI_PORT.PORTandUI_PORTdefault to their original values when unset, so existing workflows are unchanged.Test plan
pnpm dev:sandbox(no env vars) starts on 4000/4011 as beforePORT=4001 UI_PORT=4012 pnpm dev:sandboxstarts on 4001/4012, sandbox HTML loadsui.browser.jsfrom 4012