Files
supabase/apps/docs/content/guides/functions/function-configuration.mdx
Lydia Hallie a26c01217d Update Edge Functions docs (#36798)
* Update Environment Variables docs

* Update Dependencies docs

* Add Function Configuration d ocs

* Add custom Configuration section in Navigation

* Add Error Handling section

* Add new HTTP Methods section

* Update Deno 2 Guide

* Update nav

* Rm deno2 nav

* Update Deploy section

* Update CI/CD section

* Update Logging

* Update Testing

* Update Local Debugging

* Update Troubleshooting

* Update Nav

* Update CLI Quickstart

* Update Dashboard Quickstart

* Update Development Environment

* Update Nav

* Fix links

* Update apps/docs/content/guides/functions/quickstart-dashboard.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/development-environment.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/development-environment.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Use $CodeSample for multi-root example

* Use tocVideo instead of video embed

* Rm typo

* Switch Quickstart ordering

* Rephrase Docker requirement for deployment

* Add Project Structure section

* style: fix docs lint issues

* Update Regional Invocations

* Update Error Handing

* Fix linting

* Fixes

* Remove duplicate sections

* Update Auth integration

* Update Storage

* Update Database/Postgres

* Update Nav

* Update Background Tasks

* Update Ephemeral Storage

* Update Websockets

* Update Routing

* Update wasm

* Update AI models

* Fix linting issues

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/storage-caching.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/websockets.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/websockets.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Rm unnecessary lines

* Rm wrong example

* Fix typo

* Rm deno2

* Move CICD to deployment and rename routing

* Fix whitespace

* rm unnecessary spelling

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-07-10 14:18:01 +00:00

87 lines
2.9 KiB
Plaintext

---
id: function-configuration
title: Function Configuration
description: Learn how to configure your functions in Supabase.
subtitle: Configure individual function behavior. Customize authentication, dependencies, and other settings per function.
---
## Configuration
By default, all your Edge Functions have the same settings. In real applications, however, you might need different behaviors between functions.
For example:
- **Stripe webhooks** need to be publicly accessible (Stripe doesn't have your user tokens)
- **User profile APIs** should require authentication
- **Some functions** might need special dependencies or different file types
To enable these per-function rules, create `supabase/config.toml` in your project root:
```toml
# Disables authentication for the Stripe webhook.
[functions.stripe-webhook]
verify_jwt = false
# Custom dependencies for this specific function
[functions.image-processor]
import_map = './functions/image-processor/import_map.json'
# Custom entrypoint for legacy function using JavaScript
[functions.legacy-processor]
entrypoint = './functions/legacy-processor/index.js
```
This configuration tell Supabase that the `stripe-webhook` function doesn't require a valid JWT, the `image-processor` function uses a custom import map, and `legacy-processor` uses a custom entrypoint.
You set these rules once and never worry about them again. Deploy your functions knowing that the security and behavior is exactly what each endpoint needs.
<Admonition type="note">
To see more general `config.toml` options, check out [this guide](https://supabase.com/docs/guides/local-development/managing-config).
</Admonition>
---
## Skipping authorization checks
By default, Edge Functions require a valid JWT in the authorization header. If you want to use Edge Functions without Authorization checks (commonly used for Stripe webhooks), you can configure this in your `config.toml`:
```toml
[functions.stripe-webhook]
verify_jwt = false
```
You can also pass the `--no-verify-jwt` flag when serving your Edge Functions locally:
```bash
supabase functions serve hello-world --no-verify-jwt
```
<Admonition type="caution">
Be careful when using this flag, as it will allow anyone to invoke your Edge Function without a valid JWT. The Supabase client libraries automatically handle authorization.
</Admonition>
---
## Custom entrypoints
<Admonition type="note">
`entrypoint` is available only in Supabase CLI version 1.215.0 or higher.
</Admonition>
When you create a new Edge Function, it will use TypeScript by default. However, it is possible to write and deploy Edge Functions using pure JavaScript.
Save your Function as a JavaScript file (e.g. `index.js`) update the `supabase/config.toml` :
```toml
[functions.hello-world]
entrypoint = './index.js' # path must be relative to config.toml
```
You can use any `.ts`, `.js`, `.tsx`, `.jsx` or `.mjs` file as the entrypoint for a Function.