Skip to content

fix: support authenticated RPC for public demos - #987

Open
decofe wants to merge 1 commit into
mainfrom
centaur/public-demo-rpc-1791956000
Open

decofe wants to merge 1 commit into
mainfrom
centaur/public-demo-rpc-1791956000

Conversation

@decofe

@decofe decofe commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

The public docs demos still use the anonymous Moderato RPC pool even when CI has an RPC key. Add a same-origin /api/demo-rpc handler that uses the server-only TEMPO_RPC_API_KEY, and select it with VITE_RPC_PROXY=true.

The proxy accepts only supported demo methods, batches of up to five calls, 128 KiB request bodies, and 2 MiB responses. It rejects cross-site browser requests, prevents redirects, preserves gateway throttling, and sanitizes failures or responses that expose the key. The upstream is fixed to Moderato. The endpoint is public and shares its gateway client's quota.

Enable the same transport in the CI E2E build so live tests exercise the production handler through the preview server. Remove the CI-only forwarding fixture and update mocked browser tests to intercept the proxy too. Without a secret, fork CI can still use the anonymous upstream. Public deployments keep their existing transports until the proxy flag is enabled.

Activation:

  • CI: keep TEMPO_RPC_API_KEY in repository Actions secrets.
  • Public docs: set TEMPO_RPC_API_KEY and VITE_RPC_PROXY=true in the docs Vercel project for the intended deployment environments, then redeploy. Only the flag is browser-visible.

Validation: all 1,215 unit tests pass, including 23 proxy and transport checks. Type and style checks pass. A running local server returns the expected chain ID through the proxy with a test credential checked by a mocked upstream. The full production build is still running locally. The rendered-page smoke check timed out during initial navigation; an existing loopback-IP account test could not connect to the localhost-bound dev server. Browser E2E validation is incomplete. No production key or deployment settings were changed.

Prompted by: @Zygimantass

Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tempo-docs Ready Ready Preview Oct 14, 2026 5:53am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — fa720e8e Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants