Skip to content

Support per function regions from vercel.json#15149

Merged
ctgowrie merged 2 commits intomainfrom
cgowrie/per-func-regions
Feb 19, 2026
Merged

Support per function regions from vercel.json#15149
ctgowrie merged 2 commits intomainfrom
cgowrie/per-func-regions

Conversation

@ctgowrie
Copy link
Copy Markdown
Contributor

@ctgowrie ctgowrie commented Feb 19, 2026

Update next builder to allow per function regions from vercel.json

Enables vercel.json below to be mapped into build output API lambdas

  "regions": ["fra1"],
  "functions": {
    "src/app/api/v3/**/cle1/route.ts": {
      "regions": ["cle1"],
      "functionFailoverRegions": ["pdx1"]
    },
    "src/app/api/v3/**/iad1/route.ts": {
      "regions": ["iad1"],
      "functionFailoverRegions": ["pdx1"]
    }
  },

Note

Low Risk Change

This PR adds support for passing through regions and functionFailoverRegions configuration from vercel.json to lambda build output, a straightforward feature addition with no security implications.

  • Adds regions and functionFailoverRegions properties to LambdaGroup type
  • Passes region config through to lambda build output in server-build.ts
  • Adds helper function regionsArrayEqual for comparing region arrays in grouping logic

Risk assessment for commit 2c3a826.

@ctgowrie ctgowrie requested review from a team, huozhi, ijjk, timneutkens and ztanner as code owners February 19, 2026 18:38
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 2c3a826

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vercel/next Patch
vercel Patch

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 19, 2026

📦 CLI Tarball Ready

The Vercel CLI tarball for this PR is now available!

Quick Test

You can test this PR's CLI directly by running:

npx https://vercel-6qihyw349.vercel.sh/tarballs/vercel.tgz --help

Use in vercel.json

To use this CLI version in your project builds, add to your vercel.json:

{
  "build": {
    "env": {
      "VERCEL_CLI_VERSION": "vercel@https://vercel-6qihyw349.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

Python Runtime Wheel

A Python runtime wheel was also built for this PR.
To use in your Python project builds, also set this environment variable:

VERCEL_RUNTIME_PYTHON="vercel-runtime @ https://vercel-6qihyw349.vercel.sh/tarballs/vercel_runtime-0.5.0.dev1771527177+2c3a826-py3-none-any.whl"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 19, 2026

🧪 Unit Test Strategy

Comparing: 95d86142c3a826 (view diff)

Strategy: Affected packages only

✅ Only testing packages that have been modified or depend on modified packages.

Affected packages - 2 (5%)
  1. @vercel/next
  2. vercel
Unaffected packages - 38 (95%)
  1. @vercel-internals/get-package-json
  2. @vercel/backends
  3. @vercel/build-utils
  4. @vercel/cervel
  5. @vercel/cli-auth
  6. @vercel/client
  7. @vercel/config
  8. @vercel/detect-agent
  9. @vercel/edge
  10. @vercel/elysia
  11. @vercel/error-utils
  12. @vercel/express
  13. @vercel/fastify
  14. @vercel/firewall
  15. @vercel/frameworks
  16. @vercel/fs-detectors
  17. @vercel/functions
  18. @vercel/gatsby-plugin-vercel-builder
  19. @vercel/go
  20. @vercel/h3
  21. @vercel/hono
  22. @vercel/hydrogen
  23. @vercel/koa
  24. @vercel/nestjs
  25. @vercel/node
  26. @vercel/oidc
  27. @vercel/oidc-aws-credentials-provider
  28. @vercel/python
  29. @vercel/python-analysis
  30. @vercel/redwood
  31. @vercel/related-projects
  32. @vercel/remix-builder
  33. @vercel/routing-utils
  34. @vercel/ruby
  35. @vercel/rust
  36. @vercel/static-build
  37. @vercel/static-config
  38. examples

Results

  • Unit tests: Only affected packages will run unit tests
  • E2E tests: Running in parallel via E2E Tests workflow
  • Type checks: Only affected packages will run type checks

This comment is automatically generated based on the affected testing strategy

@ctgowrie ctgowrie merged commit 5d1f55a into main Feb 19, 2026
225 of 227 checks passed
@ctgowrie ctgowrie deleted the cgowrie/per-func-regions branch February 19, 2026 19:22
ctgowrie pushed a commit that referenced this pull request Feb 19, 2026
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 publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). 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@50.21.0

### Minor Changes

- Add `--all` flag to `vercel ls` command and improve behavior when not
linked to a project
([#15143](#15143))

- `vercel ls` no longer requires a linked project. When not linked, it
now lists all deployments across all projects in the current scope
- Added `--all` flag to explicitly list deployments across all projects,
even when linked to a specific project
- Added "Project" column to the deployment table output to show which
project each deployment belongs to
- JSON output (`--format json`) is unchanged and continues to include
the `name` field for project name

### Patch Changes

- fix(cli): Handle SIGINT during upgrade prompt without showing a
stacktrace ([#15105](#15105))

- Use formatted tables for `metrics schema` output, matching the
convention used by other list commands
([#15138](#15138))

- Updated dependencies
\[[`5d1f55af04d0fdba7e7ac86f9eeda44316f54f5b`](5d1f55a)]:
    -   @vercel/next@4.15.31

## @vercel/config@0.0.33

### Patch Changes

- Fix rewrite regexp conversion when header transforms are present
([#15134](#15134))

## @vercel/next@4.15.31

### Patch Changes

- Added support for `regions` and `functionFailoverRegions` in
per-function configuration from `vercel.json` for Next.js projects.
([#15149](#15149))

## @vercel/python-runtime@0.4.3

### Patch Changes

- fix formatting and lint
([#15142](#15142))


<!-- VADE_RISK_START -->
> [!NOTE]
> Low Risk Change
>
> This PR is an automated Changesets release that only bumps version
numbers in package.json files, updates CHANGELOG.md files, and deletes
changeset markdown files - no code logic changes.
> 
> - Version bumps in package.json files (vercel, @vercel/config,
@vercel/next, @vercel/python-runtime)
> - CHANGELOG.md updates documenting previous changes
> - Deleted .changeset/*.md files consumed by release process
>
> <sup>Risk assessment for [commit
3b54c69](https://github.com/vercel/vercel/commit/3b54c6956719db3f1dfd50629330f42ab8143af6).</sup>
<!-- VADE_RISK_END -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@RobbyUitbeijerse
Copy link
Copy Markdown

RobbyUitbeijerse commented Feb 23, 2026

Hey Vercel team, our existing project (without any vercel.json) started running into the following since last Friday. Not quite sure if it's related but it might be good to know. This is the only region related PR I could find that was recently closed, so it might be related.

15:16:38.486 
Build Completed in /vercel/output [4m]
15:16:38.850 
Deploying outputs...
15:16:43.883 
Error: Invalid region: auto, allowed values are: cdg1, arn1, dub1, lhr1, iad1, sfo1, pdx1, cle1, gru1, hkg1, hnd1, icn1, kix1, sin1, bom1, syd1, fra1, cpt1, dxb1, yul1

To clarify, deployments were fine before Friday afternoon, we haven't made any changes in the Vercel dashboard and we do have regions selected in the Settings > Functions (cdg1, dub1, fra1), I also attempted to just change regions, redeploy, change them back etc to make sure invalid config wasn't cached somewhere in the build cache.

[edit] I found the cause, but it did curiously start being an issue since last Friday. We had it in our project for months already, even though it was probably invalid the moment we introduced it. The culprit was a route with the following defined:

export const preferredRegion = 'auto';

@ctgowrie
Copy link
Copy Markdown
Contributor Author

Hey Vercel team, our existing project (without any vercel.json) started running into the following since last Friday. Not quite sure if it's related but it might be good to know. This is the only region related PR I could find that was recently closed, so it might be related.

15:16:38.486 
Build Completed in /vercel/output [4m]
15:16:38.850 
Deploying outputs...
15:16:43.883 
Error: Invalid region: auto, allowed values are: cdg1, arn1, dub1, lhr1, iad1, sfo1, pdx1, cle1, gru1, hkg1, hnd1, icn1, kix1, sin1, bom1, syd1, fra1, cpt1, dxb1, yul1

To clarify, deployments were fine before Friday afternoon, we haven't made any changes in the Vercel dashboard and we do have regions selected in the Settings > Functions (cdg1, dub1, fra1), I also attempted to just change regions, redeploy, change them back etc to make sure invalid config wasn't cached somewhere in the build cache.

[edit] I found the cause, but it did curiously start being an issue since last Friday. We had it in our project for months already, even though it was probably invalid the moment we introduced it. The culprit was a route with the following defined:

export const preferredRegion = 'auto';

@RobbyUitbeijerse thanks for the report. Can you please file a Vercel support ticket with your project information so we can take a deeper look?

@RobbyUitbeijerse
Copy link
Copy Markdown

RobbyUitbeijerse commented Feb 23, 2026

@ctgowrie thanks for getting back so quickly! done and done. I didn't actually add the information I added in later in my previous comment and it doesn't seem to be possible to add some context after creating the case for support, but let me know if I can help out by providing more info somehow

@ctgowrie
Copy link
Copy Markdown
Contributor Author

ctgowrie commented Feb 23, 2026

@ctgowrie thanks for getting back so quickly! done and done. I didn't actually add the information I added in later in my previous comment and it doesn't seem to be possible to add some context after creating the case for support, but let me know if I can help out by providing more info somehow

@RobbyUitbeijerse Can you share a link to the support case? Feel free to send to my email at casey.gowrie@vercel.com

ctgowrie added a commit that referenced this pull request Feb 23, 2026
ctgowrie added a commit that referenced this pull request Feb 23, 2026
This reverts commit 5d1f55a.

Vercel build system does not properly support per function regions yet,
so revert this PR temporarily while we land more robust support there.
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.

4 participants