runner: migrate example installs to pnpm#41
Draft
demtario wants to merge 11 commits into
Draft
Conversation
…andsontable-18 examples: modernize Handsontable 18 examples
b51ae74 to
f4277a3
Compare
The message named only Vue/Angular from when those were the only container-engine examples; it now covers react-js, ant-design, mui, and base-web too, and was masking real session-start errors behind confusing wording.
pnpm (10.33-10.34), unlike npm, does not strip the -- separator when the target script resolves to a real binary — it forwards a literal "--" as the script's first argument. Vite's CLI treats that as "stop parsing options," so --host/--port silently become inert positional args instead of flags, and the dev server never actually binds where the readiness probe expects it (stuck "Booting preview..." forever). Switch react-js/ant-design/mui/base-web/remix to `pnpm exec <bin> <flags>`, matching vue's already-correct invocation.
wrangler.jsonc sets PREVIEW_HOST to demos.handsontable.com unconditionally (vars apply to both wrangler dev and wrangler deploy), a real public wildcard that routes to the deployed worker, not the local one. Container preview sessions started via local wrangler dev were getting a previewUrl on that domain, so the iframe hit prod and got INVALID_TOKEN for a session/token prod never issued. Overriding PREVIEW_HOST="" in .dev.vars falls back to the request host, resolving as *.localhost:8787 (RFC 6761) back to the local worker.
When routes are declared in wrangler.jsonc, wrangler dev simulates the first route's host on every request (request.url and Host both become demos.handsontable.com regardless of the actual request hostname; only the pathname passes through). That destroys the <port>-<sandboxId>-<token>.* preview hostnames the Sandbox SDK's proxyToSandbox() routes by, so Tier-2 local preview could never work — no PREVIEW_HOST value could fix it. There is no config key or CLI flag to disable the simulation (wrangler gates it on inferOriginFromRoutes, which only the programmatic startWorker API can set). Declare no routes in wrangler.jsonc and attach the production routes via `wrangler deploy --routes …` in the deploy script instead. With no routes, wrangler dev passes the real Host through verbatim, so *.localhost:8787 preview URLs (PREVIEW_HOST="localhost:8787" in .dev.vars) flow through the exact same proxyToSandbox() path as production — HTML, assets, and the HMR WebSocket all verified working locally, including two concurrent sessions and token rejection. Also corrects the local-dev docs from the previous commit: an empty-string PREVIEW_HOST override is silently ignored by wrangler; it must be set to a real value, and removing routes from the dev config is the other required half of the recipe. Caveat: the --routes flags cannot carry zone_name; wrangler infers the zone on real deploys (dry-run validated the flags but not inference) — watch the first production deploy.
Records why wrangler.jsonc must not declare routes (wrangler dev simulates the first route's host on every request, destroying the preview hostnames proxyToSandbox routes by), corrects ADR-0011's local-dev claim, and documents the rejected path-based-proxy alternative and the deploy-time zone-inference caveat.
f85528c to
f544a0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
pnpm installat repo root and inrunner/node scripts/prepare-container.mjs --allregenerates container contexts cleanlynpx wrangler devlocally spins up Tier-2 containers using pnpm installs without errors🤖 Generated with Claude Code