The edge_deployment function provides tools for deploying and managing Supabase Edge Functions.
This function simplifies the process of deploying, updating, and managing Edge Functions in a Supabase project. It provides a command-line interface and programmatic API for common deployment tasks.
- Deploy new Edge Functions
- Update existing Edge Functions
- List deployed functions
- Get function details
- Delete functions
- Run functions locally for testing
The Edge Deployment function is organized into several components:
- Command-line interface
- API client for Supabase Functions API
- Configuration management
- Deployment utilities
| Variable | Description | Default |
|---|---|---|
SUPABASE_ACCESS_TOKEN |
Supabase access token for API authentication | Required |
SUPABASE_PROJECT_ID |
ID of the Supabase project | Required |
FUNCTION_DEPLOY_PATH |
Path to the functions to deploy | ./functions |
The function provides several shell scripts for common operations:
build.sh: Build functions for deploymentlist-functions.sh: List all deployed functionsrun-and-list.sh: Run a function locally and list all functionsrun-local.sh: Run a function locally for testing
The function can also be used programmatically:
import { deployFunction, listFunctions, deleteFunction } from './edge_deployment';
// Deploy a function
await deployFunction('my-function', './path/to/function');
// List all functions
const functions = await listFunctions();
// Delete a function
await deleteFunction('my-function');- Build the function code
- Package the function into a deployable format
- Upload the function to Supabase
- Configure the function settings
- Activate the function
- Access tokens should be kept secure
- Function code should be reviewed before deployment
- Functions should follow the principle of least privilege
- Sensitive information should be stored in environment variables, not in the function code