The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add types for available regions in the docs (#22654)
Rodrigo Mansuelif44637d376f4
diff --git a/apps/docs/content/guides/functions/regional-invocation.mdx b/apps/docs/content/guides/functions/regional-invocation.mdxindex f5daa3f19f4..423d0127dda 100644--- a/apps/docs/content/guides/functions/regional-invocation.mdx+++ b/apps/docs/content/guides/functions/regional-invocation.mdx@@ -66,6 +66,20 @@ These are the currently supported region values you can provide for `x-region` h- `us-west-1`- `us-west-2`+## Using the client library++You can also specify the region when invoking a Function using the Supabase client library:++```js+const { createClient, FunctionRegion } = require('@supabase/supabase-js')+const { data: ret, error } = await supabase.functions.invoke('my-function-name', {+ headers: { 'Content-Type': 'application/json' },+ method: 'GET',+ body: {},+ region: FunctionRegion.UsEast1,+})+```+## Handling regional outagesIf you explicitly specify the region via `x-region` header, requests **will NOT** be automatically re-routed to another region and you should consider temporarily changing regions during the outage.diff --git a/apps/docs/spec/supabase_js_v2.yml b/apps/docs/spec/supabase_js_v2.ymlindex d9d829db21a..53e7e8cf7fa 100644--- a/apps/docs/spec/supabase_js_v2.yml+++ b/apps/docs/spec/supabase_js_v2.yml@@ -568,7 +568,7 @@ functions:notes: |- Requires either an email or phone number.- This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number.- - If the user doesn't exist, `signInWithOtp()` will signup the user instead. To restrict this behaviour, you can set `shouldCreateUser` in `SignInWithPasswordlessCredentials.options` to `false`.+ - If the user doesn't exist, `signInWithOtp()` will signup the user instead. To restrict this behavior, you can set `shouldCreateUser` in `SignInWithPasswordlessCredentials.options` to `false`.- If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP.- If you're using phone, you can configure whether you want the user to receive a OTP.- The magic link's destination URL is determined by the [`SITE_URL`](/docs/guides/auth/concepts/redirect-urls).@@ -4925,7 +4925,7 @@ functions:notes: |- Requires an Authorization header.- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.- - When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialise it and attach the `Content-Type` header as `application/json`. You can override this behaviour by passing in a `Content-Type` header of your own.+ - When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialize it and attach the `Content-Type` header as `application/json`. You can override this behavior by passing in a `Content-Type` header of your own.- Responses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default.examples:- id: basic-invocation@@ -4991,6 +4991,36 @@ functions:method: 'DELETE'})```+ - id: regional-invocation+ name: Invoking a Function in the UsEast1 region+ description: |+ Here are the available regions:+ - `FunctionRegion.Any`+ - `FunctionRegion.ApNortheast1`+ - `FunctionRegion.ApNortheast2`+ - `FunctionRegion.ApSouth1`+ - `FunctionRegion.ApSoutheast1`+ - `FunctionRegion.ApSoutheast2`+ - `FunctionRegion.CaCentral1`+ - `FunctionRegion.EuCentral1`+ - `FunctionRegion.EuWest1`+ - `FunctionRegion.EuWest2`+ - `FunctionRegion.EuWest3`+ - `FunctionRegion.SaEast1`+ - `FunctionRegion.UsEast1`+ - `FunctionRegion.UsWest1`+ - `FunctionRegion.UsWest2`+ isSpotlight: true+ code: |+ ```js+ import { createClient, FunctionRegion } from '@supabase/supabase-js'++ const { data, error } = await supabase.functions.invoke('hello', {+ body: { foo: 'bar' },+ region: FunctionRegion.UsEast1+ })+ ```+- id: calling-with-get-verbname: Calling with GET HTTP verbdescription: |