Skip to content

Commit 541d2a4

Browse files
committed
fix(redirects): serve legacy redirects in production via render.yaml
Production runs on Render (a manually-created static site), which ignores vercel.json — so the redirects wired up in #71 never applied in prod. The live service also had broad SPA-fallback rewrites (/sdk/*, /react/*, /smart-wallet/*, /meta-infra/*, /recovery-flow/*) that, under Render's first-match-by-priority routing, swallowed ~145 of the 201 legacy URLs into the app shell (-> in-app 404). - render.yaml: Render Blueprint that adopts the existing "docs" static site. Generated redirects sit ABOVE the SPA-fallback rewrites so they take priority. - redirects.config.js stays the single source of truth; folds in /magic-account (collapsing its stale /sdk/advanced/chain-abstraction hop). - scripts/sync-render-redirects.mjs splices the generated block between sentinels, preserving the hand-maintained service def + fallbacks. Output is prettier-clean by construction. - CI (redirects-in-sync) + npm scripts now target render.yaml. - Remove the unused vercel.json and its sync script.
1 parent c8ed486 commit 541d2a4

8 files changed

Lines changed: 774 additions & 1072 deletions

File tree

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: redirects-in-sync
22

3-
# Guarantees vercel.json matches redirects.config.js (the single source of
4-
# truth). Vercel reads vercel.json at the start of a deployment, so a commit
5-
# that edits redirects.config.js without regenerating vercel.json would ship
6-
# stale production redirects. This job regenerates the file and fails if it
7-
# differs from what's committed.
3+
# Guarantees render.yaml matches redirects.config.js (the single source of
4+
# truth). Render reads render.yaml at the start of a deployment, so a commit
5+
# that edits redirects.config.js without regenerating render.yaml would ship
6+
# stale production redirects. This job regenerates the generated block and fails
7+
# if it differs from what's committed.
88

99
on:
1010
pull_request:
@@ -22,14 +22,14 @@ jobs:
2222

2323
# No `npm install` needed: the sync script uses only Node built-ins and
2424
# imports the local redirects.config.js.
25-
- name: Regenerate vercel.json from redirects.config.js
26-
run: node scripts/sync-vercel-redirects.mjs
25+
- name: Regenerate render.yaml from redirects.config.js
26+
run: node scripts/sync-render-redirects.mjs
2727

28-
- name: Fail if vercel.json is out of date
28+
- name: Fail if render.yaml is out of date
2929
run: |
30-
if [ -n "$(git status --porcelain vercel.json)" ]; then
31-
echo "::error::vercel.json is out of sync with redirects.config.js. Run 'npm run sync-redirects' and commit the result."
32-
git --no-pager diff vercel.json
30+
if [ -n "$(git status --porcelain render.yaml)" ]; then
31+
echo "::error::render.yaml is out of sync with redirects.config.js. Run 'npm run sync-redirects' and commit the result."
32+
git --no-pager diff render.yaml
3333
exit 1
3434
fi
35-
echo "vercel.json is in sync with redirects.config.js."
35+
echo "render.yaml is in sync with redirects.config.js."

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "module",
44
"scripts": {
55
"dev": "vocs dev",
6-
"sync-redirects": "node scripts/sync-vercel-redirects.mjs",
7-
"prebuild": "node scripts/sync-vercel-redirects.mjs",
6+
"sync-redirects": "node scripts/sync-render-redirects.mjs",
7+
"prebuild": "node scripts/sync-render-redirects.mjs",
88
"build": "vocs build",
99
"preview": "vocs preview",
1010
"format": "prettier --write ."

redirects.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
*
44
* Single source of truth for redirects. Consumed in two places:
55
* - the dev-server redirect middleware in vocs.config.tsx (local `vocs dev`)
6-
* - `npm run sync-redirects`, which mirrors these into vercel.json so Vercel
6+
* - `npm run sync-redirects`, which splices these into render.yaml so Render
77
* serves them in production (Vocs has no build-time redirect support).
88
*
9-
* After editing, run `npm run sync-redirects` and commit the updated vercel.json.
9+
* After editing, run `npm run sync-redirects` and commit the updated render.yaml.
1010
*
1111
* Follows the OffchainLabs/arbitrum-docs redirects.config.js pattern. Kept as a
1212
* `.js` module (types in redirects.config.d.ts) so it resolves natively in both
@@ -128,6 +128,11 @@ export const redirects = [
128128
{ from: "/smart-routing-address", to: "/onramp/smart-routing-address" },
129129
{ from: "/global-address", to: "/onramp/smart-routing-address" },
130130

131+
// Magic Account (legacy) → Chain Abstraction. Was a manual Render redirect to
132+
// /sdk/advanced/chain-abstraction, itself now legacy; collapse the hop straight
133+
// to the live page. (/magic-account/* subpaths are handled in render.yaml.)
134+
{ from: "/magic-account", to: "/smart-accounts/chain-abstraction/overview" },
135+
131136
// Embedded Wallet docs live at /wallets/* (alpha — unlisted in sidebars).
132137

133138
// React WaaS hooks → Advanced › React Hooks (legacy)

0 commit comments

Comments
 (0)