feat(world-vercel): support new env vars for Vercel Deployment Protection#1824
feat(world-vercel): support new env vars for Vercel Deployment Protection#1824TooTallNate merged 6 commits intomainfrom
Conversation
Allows sending a Vercel Deployment Protection bypass secret via the `x-vercel-protection-bypass` header on all outbound requests made by the Vercel world, enabling use against protected deployments (e.g. previews, or workflow-server once protection is enabled).
🦋 Changeset detectedLatest commit: 515010b The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🐘 Local Postgres (2 failed)nuxt-stable (2 failed):
Details by Category✅ 💻 Local Development
✅ 📦 Local Production
❌ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
📊 Benchmark Results
workflow with no steps💻 Local Development
workflow with 1 step💻 Local Development
workflow with 10 sequential steps💻 Local Development
workflow with 25 sequential steps💻 Local Development
workflow with 50 sequential steps💻 Local Development
Promise.all with 10 concurrent steps💻 Local Development
Promise.all with 25 concurrent steps💻 Local Development
Promise.all with 50 concurrent steps💻 Local Development
Promise.race with 10 concurrent steps💻 Local Development
Promise.race with 25 concurrent steps💻 Local Development
Promise.race with 50 concurrent steps💻 Local Development
workflow with 10 sequential data payload steps (10KB)💻 Local Development
workflow with 25 sequential data payload steps (10KB)💻 Local Development
workflow with 50 sequential data payload steps (10KB)💻 Local Development
workflow with 10 concurrent data payload steps (10KB)💻 Local Development
workflow with 25 concurrent data payload steps (10KB)💻 Local Development
workflow with 50 concurrent data payload steps (10KB)💻 Local Development
Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
stream pipeline with 5 transform steps (1MB)💻 Local Development
10 parallel streams (1MB each)💻 Local Development
fan-out fan-in 10 streams (1MB each)💻 Local Development
SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details. |
There was a problem hiding this comment.
Pull request overview
Adds support in @workflow/world-vercel for sending Vercel Deployment Protection bypass credentials via WORKFLOW_VERCEL_PROTECTION_BYPASS, ensuring outbound requests can access protected preview/production deployments.
Changes:
- Introduces
getProtectionBypassHeader()helper to conditionally produce thex-vercel-protection-bypassheader. - Injects the bypass header into the shared
getHeaders()path (coversmakeRequest/streamer/refs). - Spreads the bypass header into direct
fetch()calls inresolve-latest-deployment.tsandencryption.ts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/world-vercel/src/utils.ts | Adds bypass-header helper and includes bypass header in shared header construction. |
| packages/world-vercel/src/resolve-latest-deployment.ts | Adds bypass header to direct Vercel API request headers. |
| packages/world-vercel/src/encryption.ts | Adds bypass header to direct Vercel API request headers. |
| .changeset/world-vercel-protection-bypass.md | Declares a minor release for the new env var behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace hard-coded WORKFLOW_SERVER_URL_OVERRIDE constant with a function that reads from the VERCEL_WORKFLOW_SERVER_URL env var. Allows configuring the workflow-server URL per-deployment (e.g. workbench Preview envs pointing to a branch deployment) without editing source.
Set VERCEL_WORKFLOW_SERVER_URL and VERCEL_WORKFLOW_SERVER_PROTECTION_BYPASS on PR runs so e2e tests hit the protected workflow-server preview; leave unset on main so production runs use the public default URL.
karthikscale3
left a comment
There was a problem hiding this comment.
looks good. the codex review comments are worth addressing
- Consolidate bypass header logic in getHeaders() to reuse getProtectionBypassHeader() instead of duplicating env lookup. - Use consistent 'Authorization' casing in direct fetch() calls. - Add unit tests for getProtectionBypassHeader, getHttpUrl, and getHeaders covering env var toggling and proxy/override combinations.
Summary
Adds two new environment variables to
@workflow/world-vercelfor use with Vercel Deployment Protection.VERCEL_WORKFLOW_SERVER_PROTECTION_BYPASSWhen set, the value is sent as the
x-vercel-protection-bypassheader on every outbound HTTP request made by the Vercel world (viamakeRequest, the streamer, refs, and directapi.vercel.comcalls inresolve-latest-deployment.tsandencryption.ts).Needed because workflow-server is getting Vercel Deployment Protection enabled, so external callers need a way to authenticate bypass.
VERCEL_WORKFLOW_SERVER_URLReplaces the need to edit source to change the workflow-server URL. When set, requests bypass the default production host (
https://vercel-workflow.com) and use the override instead. When going through theapi.vercel.com/v1/workflowproxy, the value is forwarded via thex-vercel-workflow-api-urlheader so the proxy routes accordingly.The existing inline
WORKFLOW_SERVER_URL_OVERRIDEconst is preserved as an empty-string literal so external CI rewrite tooling continues to work unmodified; the inline const wins over the env var when non-empty.Implementation
getProtectionBypassHeader()helper inutils.tsreturns the bypass header when the env var is set.getHeaders()applies the bypass header automatically (coversmakeRequest, streamer, refs).api.vercel.comfetches inresolve-latest-deployment.tsandencryption.tsspread the helper into their headers.getWorkflowServerUrlOverride()function prefers the inline const, falls back toVERCEL_WORKFLOW_SERVER_URL.api.vercel.com/v1/workflowproxy transparently —http-proxy-middlewareforwards all request headers by default, so no proxy-side changes needed.Testing
pnpm --filter @workflow/world-vercel typecheck✅pnpm --filter @workflow/world-vercel test— 79 tests pass ✅