Skip to content

[pull] main from tldraw:main#535

Merged
pull[bot] merged 2 commits into
code:mainfrom
tldraw:main
May 6, 2026
Merged

[pull] main from tldraw:main#535
pull[bot] merged 2 commits into
code:mainfrom
tldraw:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 6, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

kaneel and others added 2 commits May 6, 2026 08:24
### Problem

Docs and marketing are two separate Next apps on Vercel. When marketing
rewrites a path (e.g. `tldraw.dev/quick-start`) and returns docs HTML,
the browser’s address bar is still the marketing origin, but the HTML
referenced `/_next/static/...` as root-relative paths. Those requests
went to marketing’s `/_next` (wrong app / wrong hashes) instead of docs’
`/_next`.

Setting `ASSET_PREFIX` only in some environments (or only on Production)
was easy to get wrong: Preview builds often had no prefix, and
Production could pin the wrong hostname (e.g. a `*.vercel.app` alias)
while the live site was `tldraw.dev`, which caused 404s, cache skew (old
HTML vs new static files), and confusion.

### What we changed

`assetPrefix` (and the same base for `assetUrl()` on `public/` paths)
now resolves to:

1. `ASSET_PREFIX` when set (explicit override), else
2. `https://${VERCEL_URL}` on Vercel (the current deployment URL), else
3. unset locally → root-relative assets as before.

### Why it helps

- Every Vercel build automatically points JS/CSS (and prefixed `public/`
URLs) at that deployment’s static host, without maintaining
Preview-specific `ASSET_PREFIX` for every branch.
- `ASSET_PREFIX` remains an escape hatch when you need a fixed canonical
origin (e.g. force the apex in prod).
- Docs HTML served through rewrites still loads `/_next` from the docs
deployment that produced the page, which removes the “wrong `/_next`
host” class of bugs.

### Change type

- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
In order to fix dotcom deploys, this PR bumps the pinned `vercel` CLI
from `^34.4.0` to `^52.0.0`. The Vercel deploy endpoint now rejects
clients older than `47.2.2` with the error below, so deploys fail at the
upload step. Latest stable is `53.1.1` but our `npmMinimalAgeGate: 7d`
setting in `.yarnrc.yml` blocks anything younger than 7 days, so
`52.0.0` is the highest currently installable.

Verified all CLI surfaces used in `internal/scripts/deploy-dotcom.ts`
still exist in v52: `vercel link --project`, `vercel deploy --prebuilt
[--prod]`, `vercel alias set`, global `--token` / `--scope` / `--yes`
flags, `VERCEL_ORG_ID` / `VERCEL_PROJECT_ID` env vars, and the
`Inspect:` / `Preview:` / `Production:` stdout lines that `deploySpa()`
regex-parses.

### Deploy error

```
Error: Your Vercel CLI version is outdated. This endpoint requires version 47.2.2 or later. Please upgrade by running npm i -g vercel@latest.
```

### Change type

- [x] `other`

### Test plan

- [ ] Unit tests
- [ ] End to end tests

### Code changes

| Section        | LOC change      |
| -------------- | --------------- |
| Config/tooling | +1456 / -723    |

(All churn is `yarn.lock` updates from the vercel dep bump;
`package.json` is +1/-1.)
@pull pull Bot locked and limited conversation to collaborators May 6, 2026
@pull pull Bot added the ⤵️ pull label May 6, 2026
@pull pull Bot merged commit c157638 into code:main May 6, 2026
@pull pull Bot had a problem deploying to bemo-canary May 6, 2026 09:13 Failure
@pull pull Bot had a problem deploying to deploy-production May 6, 2026 09:13 Failure
@pull pull Bot had a problem deploying to vsce publish May 6, 2026 09:13 Error
@pull pull Bot had a problem deploying to deploy-staging May 6, 2026 09:13 Error
@pull pull Bot had a problem deploying to deploy-staging May 6, 2026 09:13 Error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants