Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add docs.

thorwebdev6e93e6adc509
diff --git a/apps/reference/docs/guides/functions.mdx b/apps/reference/docs/guides/functions.mdx
index c5b4ddf8ce9..553075b1cb9 100644
--- a/apps/reference/docs/guides/functions.mdx
+++ b/apps/reference/docs/guides/functions.mdx
@@ -2,6 +2,7 @@
id: functions
title: Edge Functions
description: 'Globally distributed TypeScript functions.'
+sidebar_label: Overview
---
import Tabs from '@theme/Tabs'
@@ -11,12 +12,12 @@ const examples = [
{
name: 'With supabase-js',
description: 'Use the Supabase client inside your Edge Function.',
- href: 'https://github.com/supabase/examples/tree/main/supabase-js-v1/edge-functions',
+ href: 'https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts',
},
{
name: 'With CORS headers',
description: 'Send CORS headers for invoking from the browser.',
- href: 'https://github.com/supabase/examples/tree/main/supabase-js-v1/edge-functions/supabase/functions/browser-with-cors',
+ href: 'https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/browser-with-cors/index.ts',
},
{
name: 'React Native with Stripe',
@@ -89,7 +90,7 @@ The command outputs a URL to the Supabase Dashboard which you can open to find v
By default, Edge Functions require a valid JWT in the authorization header. This header is automatically set when invoking your function via a Supabase client library.
-If you want to use Edge Functions to handle webhooks (e.g. [Stripe payment webhooks](https://github.com/supabase/examples/tree/main/supabase-js-v1/edge-functions/supabase/functions/stripe-webhooks), or [chat bot webhooks](https://github.com/supabase/examples/tree/main/supabase-js-v1/edge-functions/supabase/functions/telegram-bot) etc.), you need to pass the `--no-verify-jwt` flag when deploying your function.
+If you want to use Edge Functions to handle webhooks (e.g. [Stripe payment webhooks](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/stripe-webhooks) etc.), you need to pass the `--no-verify-jwt` flag when deploying your function.
:::
@@ -236,7 +237,7 @@ supabase secrets list
## Examples
-You can find a list of useful [Edge Function Examples](https://github.com/supabase/examples/tree/main/supabase-js-v1/edge-functions) in our GitHub repository.
+You can find a list of useful [Edge Function Examples](https://github.com/supabase/supabase/tree/master/examples/edge-functions) in our GitHub repository.
<div class="container" style={{ padding: 0 }}>
<div class="row is-multiline">
@@ -289,6 +290,8 @@ We recommend using hyphens to name functions because hyphens are the most URL-fr
We recommend adding a check to handle [CORS Preflight](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) requests in your edge function to be able to invoke the function from browsers.
+See the [example on GitHub](https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/browser-with-cors/index.ts).
+
```ts
export const corsHeaders = {
'Access-Control-Allow-Origin': '*',
diff --git a/apps/reference/docs/guides/functions/cicd-workflow.mdx b/apps/reference/docs/guides/functions/cicd-workflow.mdx
new file mode 100644
index 00000000000..15950b15b51
--- /dev/null
+++ b/apps/reference/docs/guides/functions/cicd-workflow.mdx
@@ -0,0 +1,36 @@
+---
+id: cicd-workflow
+title: CI / CD Workflow
+description: How to deploy Supabase Edge Functions with a CI / CD pipeline.
+---
+
+As described in the Supabase CLI [CI / CD Workflow documentation](/docs/guides/cli/cicd-workflow), you can use the [`setup-cli` GitHub Action](https://github.com/marketplace/actions/supabase-cli-action) to run Supabase CLI commands in your GitHub Actions, for example to deploy a Supabase Edge Function:
+
+```yaml
+name: Deploy Function
+
+on:
+ push:
+ branches:
+ - main
+ workflow_dispatch:
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+
+ env:
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
+ PROJECT_ID: zdtdtxajzydjqzuktnqx
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: supabase/setup-cli@v1
+ with:
+ version: 1.0.0
+
+ - run: supabase functions deploy your-function-name --project-ref $PROJECT_ID
+```
+
+See the [example on GitHub](https://github.com/supabase/supabase/blob/master/examples/edge-functions/.github/workflows/deploy.yaml).
diff --git a/apps/reference/nav/_referenceSidebars.js b/apps/reference/nav/_referenceSidebars.js
index bab8deb5fea..740a0482b85 100644
--- a/apps/reference/nav/_referenceSidebars.js
+++ b/apps/reference/nav/_referenceSidebars.js
@@ -154,9 +154,9 @@ const sidebars = {
},
{
type: 'category',
- label: 'Functions',
+ label: 'Edge Functions',
collapsed: true,
- items: ['guides/functions'],
+ items: ['guides/functions', 'guides/functions/cicd-workflow'],
},
{
type: 'category',