mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
<!-- ccr-slack-attribution --> _Requested by **Kalleby Santos** · [Slack thread](https://supabase.slack.com/archives/C02KMRX22NR/p1785871243937099?thread_ts=1785871243.937099&cid=C02KMRX22NR)_ ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Docs update — one-line content fix. ## What is the current behavior? The [Regional Invocations](https://supabase.com/docs/guides/functions/regional-invocation) page's "Available regions" section lists every Edge Functions region **except `eu-central-2`** (AWS Europe, Zurich). The region has been live in production for a while, but it was never added to the docs. A user reading this page to pick a region for `x-region` / `FunctionRegion` had no way to know Zurich was an option — the page reads as an exhaustive list, so the omission actively implies the region doesn't exist. Reported by Kalleby Santos (Edge Functions team). Linear: [FUNC-761 — Add eu-central-2 to regional invocation docs page](https://linear.app/supabase/issue/FUNC-761/add-eu-central-2-to-regional-invocation-docs-page) ## What is the new behavior? **Before:** the Europe group listed `eu-central-1`, `eu-west-1`, `eu-west-2`, `eu-west-3`. **After:** `eu-central-2` (Zurich) is listed alongside the others, so the page reflects the regions Edge Functions actually serves. ### How One line added to `apps/docs/content/guides/functions/regional-invocation.mdx`, in the **Europe** group directly after `eu-central-1`, following the list's existing sort-by-region-code order and the surrounding `` `code` (Short location) `` label style: ```diff **Europe:** - `eu-central-1` (Frankfurt) +- `eu-central-2` (Zurich) - `eu-west-1` (Ireland) - `eu-west-2` (London) - `eu-west-3` (Paris) ``` No other files changed. This page's region list is hand-maintained in the MDX and is deliberately narrower than the project-creation region list in `packages/shared-data/regions.ts` (which also includes `us-east-2` and `eu-north-1`), so no shared constant needed updating and no other product's region list was touched. ## Additional context **Verification that `eu-central-2` is a real Edge Functions invocation region** — confirmed in three independent places: 1. `supabase/platform` → `pulumi/edge-runtime/Pulumi.prod.yaml:533` — `region: eu-central-2`, with `enabled: true` at `:531`. A fully provisioned prod region (360–540 always-on tasks), not a placeholder. Branch `develop`, HEAD `1f44167768f951c0c794313006bc2c9f9758c344`. 2. `supabase/platform` → `pulumi/edge-runtime-next/stack-config/Pulumi.prod.aws.euc2.yaml:6` — `aws:region: eu-central-2` under the `Edge-Functions/K8s-Prod` environment, tagged `product: functions`. 3. `supabase/api-gateway` → `customer-router/wrangler.toml` — `eu-central-2` is present in the `EDGE_FUNCTIONS_REGIONAL_ORIGINS` map (`eu-central-2 = "https://eu-central-2.edge-runtime.supabase.green"`). This is the table that resolves the `x-region` header, so regional invocation into Zurich is genuinely routable — not just deployed. **For a reviewer to confirm separately (intentionally not in this diff):** production infra has 16 enabled Edge Functions regions, so `us-east-2` (Ohio, `pulumi/edge-runtime/Pulumi.prod.yaml:507`, `enabled: true`) is *also* missing from this page. It's excluded here because we don't yet know whether that omission is deliberate; it's being confirmed with the team and can be a follow-up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017UJhSvVpPfYNaHZ8Y1x3sy --- _Generated by [Claude Code](https://claude.ai/code/session_017UJhSvVpPfYNaHZ8Y1x3sy)_ Co-authored-by: Claude <noreply@anthropic.com>
105 lines
2.8 KiB
Plaintext
105 lines
2.8 KiB
Plaintext
---
|
|
id: 'function-regional-invocation'
|
|
title: 'Regional Invocations'
|
|
description: 'How to execute an Edge Functions in a particular region.'
|
|
subtitle: 'Execute Edge Functions in specific regions for optimal performance.'
|
|
---
|
|
|
|
Edge Functions automatically execute in the region closest to the user making the request. This reduces network latency and provides faster responses.
|
|
|
|
However, if your function performs intensive database or storage operations, executing in the same region as your database often provides better performance:
|
|
|
|
- **Bulk database operations:** Adding or editing many records
|
|
- **File uploads:** Processing large files or multiple uploads
|
|
- **Complex queries:** Operations requiring multiple database round trips
|
|
|
|
---
|
|
|
|
## Available regions
|
|
|
|
The following regions are supported:
|
|
|
|
**Asia Pacific:**
|
|
|
|
- `ap-northeast-1` (Tokyo)
|
|
- `ap-northeast-2` (Seoul)
|
|
- `ap-south-1` (Mumbai)
|
|
- `ap-southeast-1` (Singapore)
|
|
- `ap-southeast-2` (Sydney)
|
|
|
|
**North America:**
|
|
|
|
- `ca-central-1` (Canada Central)
|
|
- `us-east-1` (N. Virginia)
|
|
- `us-west-1` (N. California)
|
|
- `us-west-2` (Oregon)
|
|
|
|
**Europe:**
|
|
|
|
- `eu-central-1` (Frankfurt)
|
|
- `eu-central-2` (Zurich)
|
|
- `eu-west-1` (Ireland)
|
|
- `eu-west-2` (London)
|
|
- `eu-west-3` (Paris)
|
|
|
|
**South America:**
|
|
|
|
- `sa-east-1` (São Paulo)
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
You can specify the region programmatically using the Supabase Client library, or using the `x-region` HTTP header.
|
|
|
|
<$CodeTabs>
|
|
|
|
```js name=JavaScript
|
|
import { createClient, FunctionRegion } from '@supabase/supabase-js'
|
|
|
|
const { data, error } = await supabase.functions.invoke('function-name', {
|
|
...
|
|
region: FunctionRegion.UsEast1, // Execute in us-east-1 region
|
|
})
|
|
```
|
|
|
|
```bash name=cURL
|
|
curl --request POST 'https://<project_ref>.supabase.co/functions/v1/function-name' \
|
|
--header 'x-region: us-east-1' # Execute in us-east-1 region
|
|
```
|
|
|
|
</$CodeTabs>
|
|
|
|
In case you cannot add the `x-region` header to the request (e.g.: CORS requests, Webhooks), you can use `forceFunctionRegion` query parameter.
|
|
|
|
<Admonition type="note">
|
|
|
|
You can verify the execution region by looking at the `x-sb-edge-region` HTTP header in the response. You can also find it as metadata in [Edge Function Logs](/docs/guides/functions/logging).
|
|
|
|
</Admonition>
|
|
|
|
---
|
|
|
|
## Region runtime information
|
|
|
|
Functions have access to the following environment variables:
|
|
|
|
SB_REGION: The AWS region function was invoked
|
|
|
|
This is useful if you have read replicate and want to Postgres connect to a different replicate according of the Region.
|
|
|
|
---
|
|
|
|
## Region outages
|
|
|
|
When you explicitly specify a region via the `x-region` header, requests will NOT be automatically
|
|
re-routed to another region.
|
|
|
|
During outages, consider temporarily changing to a different region.
|
|
|
|
<Admonition type="caution">
|
|
|
|
Test your function's performance with and without regional specification to determine if the benefits outweigh automatic region selection.
|
|
|
|
</Admonition>
|