[vercel] fix: return 3xx responses when redirect is manual in client.fetch()#15953
Conversation
…fetch() `client.fetch()` treats any non-2xx response as an error and retries. When `redirect: 'manual'` is passed, 3xx responses now return the raw Response directly so callers can inspect the Location header. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: e88d540 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📦 CLI Tarball ReadyThe Vercel CLI tarball for this PR is now available! Quick TestYou can test this PR's CLI directly by running: npx https://vercel-8q0wsjbzm-melkeydevs-projects.vercel.app/tarballs/vercel.tgz --helpUse in vercel.jsonTo use this CLI version in your project builds, add to your {
"build": {
"env": {
"VERCEL_CLI_VERSION": "vercel@https://vercel-8q0wsjbzm-melkeydevs-projects.vercel.app/tarballs/vercel.tgz"
}
}
} |
|
Low Risk — Opt-in behavior for redirect handling in CLI fetch utility — only activates when caller explicitly passes redirect: 'manual'.
Assessed at e88d540. |
🧪 Unit Test StrategyComparing: Strategy: Code changed outside of a package - running all unit tests Affected packages - 15 (38%)
Unaffected packages - 25 (63%)
Results
This comment is automatically generated based on the affected testing strategy |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @vercel/build-utils@13.16.0 ### Minor Changes - Add shared deserialization and build-result collection utilities. ([#15961](#15961)) - Add root to experimentalServices to set a service's working directory. ([#15929](#15929)) - Add a new flag to vercel deploy to let users deploy to hive ([#15892](#15892)) ## vercel@51.3.0 ### Minor Changes - Add `vercel alerts inspect` to fetch a single alert group by id with linked project, explicit `--project`, or `--all` scope. ([#15850](#15850)) - Add root to experimentalServices to set a service's working directory. ([#15929](#15929)) - Add a new flag to vercel deploy to let users deploy to hive ([#15892](#15892)) ### Patch Changes - Return 3xx responses directly in `client.fetch()` when `redirect: 'manual'` is passed, instead of entering the error/retry path. ([#15953](#15953)) - Add JSON feature flag support to the CLI so flags can be created, updated, listed, inspected, and set with JSON variant values just like existing boolean, string, and number kinds. ([#15741](#15741)) This aligns the CLI with the recent API and dashboard changes for `json` flags, including parsing raw JSON inputs and preserving structured values in output. - Display case-insensitive feature flag rule comparisons correctly in the CLI. ([#15743](#15743)) - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 - @vercel/python@6.32.0 - @vercel/backends@0.0.61 - @vercel/elysia@0.1.64 - @vercel/express@0.1.74 - @vercel/fastify@0.1.67 - @vercel/go@3.5.0 - @vercel/h3@0.1.73 - @vercel/hono@0.2.67 - @vercel/hydrogen@1.3.6 - @vercel/koa@0.1.47 - @vercel/nestjs@0.2.68 - @vercel/next@4.16.7 - @vercel/node@5.7.6 - @vercel/redwood@2.4.12 - @vercel/remix-builder@5.7.2 - @vercel/ruby@2.3.2 - @vercel/rust@1.1.0 - @vercel/static-build@2.9.14 ## @vercel/config@0.2.0 ### Minor Changes - Add root to experimentalServices to set a service's working directory. ([#15929](#15929)) ## @vercel/fs-detectors@5.17.0 ### Minor Changes - Add root to experimentalServices to set a service's working directory. ([#15929](#15929)) ### Patch Changes - fix(node): scope entrypoint filter to `api/` directory only ([#15954](#15954)) - Add actix framework preset ([#15752](#15752)) - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`620c42ffa6d335c9a6e3e57a1e81c522696b7c2c`](620c42f), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 - @vercel/frameworks@3.24.1 ## @vercel/python@6.32.0 ### Minor Changes - Add a new flag to vercel deploy to let users deploy to hive ([#15892](#15892)) ## @vercel/backends@0.0.61 ### Patch Changes - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 ## @vercel/cervel@0.0.48 ### Patch Changes - Updated dependencies \[]: - @vercel/backends@0.0.61 ## @vercel/client@17.3.3 ### Patch Changes - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 ## @vercel/elysia@0.1.64 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/express@0.1.74 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 - @vercel/cervel@0.0.48 ## @vercel/fastify@0.1.67 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/frameworks@3.24.1 ### Patch Changes - Add actix framework preset ([#15752](#15752)) ## @vercel/gatsby-plugin-vercel-builder@2.1.14 ### Patch Changes - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 ## @vercel/h3@0.1.73 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/hono@0.2.67 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/koa@0.1.47 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/nestjs@0.2.68 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.7.6 ## @vercel/node@5.7.6 ### Patch Changes - Updated dependencies \[[`86d1f5b3cbd520af2632d4a3d6a1f24557448c0e`](86d1f5b), [`1056be976b6ba9b42cc1e2ffe895d255ab6c9850`](1056be9), [`c27eedaa1b0e3f6e3770b578f62e5463d82f06e0`](c27eeda)]: - @vercel/build-utils@13.16.0 ## @vercel/static-build@2.9.14 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@2.1.14 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
client.fetch()now returns 3xx responses directly whenredirect: 'manual'is passed, instead of entering the error/retry pathredirect: 'manual'throughclient.fetch()Why
This enables CLI commands that need to extract
Locationheaders from redirect-based API endpoints (e.g., endpoints that initialize server-side state and redirect to a browser URL).Today, the 3xx response hits
!res.ok(302 is outside 200-299), doesn't match the 400-499 bail condition, and falls through tothrow error— causing infinite retries.Test plan
redirect: 'manual'returns raw response with Location headerredirect: 'manual'follows the redirect (default behavior unchanged)🤖 Generated with Claude Code