| name | deploy-functions |
| description | Deploys Supabase edge functions individually or in groups (auth, payments, ai, data, email) with health verification and notifications. This skill should be used when deploying edge functions to Supabase, updating serverless functions, or batch deploying multiple functions. |
Deploy Functions
This skill automates the deployment of Supabase edge functions with grouping, health checks, and comprehensive reporting.
When to Use This Skill
- Deploying a single edge function after changes
- Batch deploying related functions (e.g., all payment functions)
- Deploying all functions after major updates
- Verifying function health after deployment
Function Groups
Functions are organized into logical groups for batch deployment:
auth (3 functions)
create-oauth-profile- OAuth user onboardingcreate-buyer-profile- Buyer signupcreate-creator-profile- Creator signup
payments (6 functions)
stripe-webhook- Main Stripe event handlercreator-stripe-webhook- Creator payment eventscreate-checkout-session- Buyer checkoutcreate-creator-checkout- Creator checkoutcreate-billing-portal- Stripe portal redirectcancel-subscription- Subscription cancellation
ai (6 functions)
chat-orchestrator- AI chatbot orchestration (GPT-4 + vector search)mandate-matcher- Producer mandate matchingvector-search- Raw vector similarity searchcomps-generator- Hollywood comps generationformat-fit-engine- Format analysisregenerate-embeddings- Embedding regeneration
data (4 functions)
title-intelligence- Platform data scrapingkey-visuals-collector- Visual metadata extractionanalyze-pitch-for-assets- Pitch analysisgenerate-asset- Marketing asset generation
email (2 functions)
send-email- Unified email sender (Resend API)send-approval-email- Admin approval notifications
billing (2 functions)
get-creator-billing-history- Creator subscription historycancel-subscription- Subscription cancellation
Commands
/deploy-functions chat-orchestrator # Deploy single function
/deploy-functions --group=auth # Deploy all auth functions
/deploy-functions --group=payments # Deploy all payment functions
/deploy-functions --group=ai # Deploy all AI functions
/deploy-functions --all # Deploy ALL functions
/deploy-functions --all --skip-health # Skip health checks
Deployment Workflow
Step 1: Pre-deployment Validation
Before deploying, verify requirements:
# Check Supabase CLI is available
npx supabase --version
# Verify function exists
ls supabase/functions/[function-name]/
# Check for required secrets (if function uses them)
# Note: Secrets are managed via Supabase dashboard
Step 2: Deploy Function(s)
Deploy using Supabase CLI:
# Single function
npx supabase functions deploy [function-name]
# Multiple functions (run sequentially)
npx supabase functions deploy create-oauth-profile
npx supabase functions deploy create-buyer-profile
npx supabase functions deploy create-creator-profile
Capture output for each deployment:
- Deployment URL
- Version number
- Any warnings
Step 3: Health Verification (unless --skip-health)
Verify each deployed function is responding:
# Get project URL
SUPABASE_URL="https://dlrnrgcoguxlkkcitlpd.supabase.co"
# Check function endpoint (OPTIONS request for CORS)
curl -s -o /dev/null -w "%{http_code}" \
-X OPTIONS \
"$SUPABASE_URL/functions/v1/[function-name]"
Expected responses:
- 200/204: Function is healthy
- 401: Function requires auth (expected for most functions)
- 500: Function has an error (investigate)
For functions that bypass JWT (webhooks):
# stripe-webhook should return 400 (missing body) not 500
curl -s -o /dev/null -w "%{http_code}" \
-X POST \
"$SUPABASE_URL/functions/v1/stripe-webhook"
Step 4: Report Results
Generate deployment summary:
## Edge Function Deployment Summary
**Deployed**: 3 functions (auth group)
**Time**: 2024-12-25 14:30 UTC
### Functions Deployed
| Function | Status | Health | Time |
|----------|--------|--------|------|
| create-oauth-profile | SUCCESS | HEALTHY | 8s |
| create-buyer-profile | SUCCESS | HEALTHY | 7s |
| create-creator-profile | SUCCESS | HEALTHY | 9s |
### Endpoints
All functions available at:
https://dlrnrgcoguxlkkcitlpd.supabase.co/functions/v1/[function-name]
### Notes
- All functions deployed successfully
- Health checks passed
- No secrets needed updating
Function-Specific Notes
JWT-Bypassed Functions
These functions verify auth differently (e.g., Stripe signature):
# From supabase/config.toml
[functions.stripe-webhook]
verify_jwt = false
[functions.creator-stripe-webhook]
verify_jwt = false
[functions.mandate-matcher]
verify_jwt = false
Large Functions
These functions may take longer to deploy:
| Function | Size | Deploy Time |
|---|---|---|
| chat-orchestrator | 3,328 lines | ~15s |
| stripe-webhook | 989 lines | ~10s |
| title-intelligence | 804 lines | ~10s |
Shared Dependencies
Functions using _shared/ utilities:
- All AI functions use
_shared/intent-detection.ts - Payment functions use
_shared/stripe-config.ts - Search functions use
_shared/search-cache.ts
When updating shared code, redeploy all dependent functions.
Environment Secrets
Required secrets for functions (set in Supabase dashboard):
| Secret | Used By | Required |
|---|---|---|
| OPENAI_API_KEY | AI functions | Yes |
| STRIPE_SECRET_KEY | Payment functions | Yes |
| STRIPE_WEBHOOK_SECRET | stripe-webhook | Yes |
| RESEND_API_KEY | email functions | Yes |
| SUPABASE_SERVICE_ROLE_KEY | All functions | Auto-set |
To check if secrets are set:
# Via Supabase dashboard or CLI
npx supabase secrets list
Error Handling
Deployment Failures
If deployment fails:
Check the error message:
- "Function not found" - Verify path exists
- "Build failed" - Check TypeScript errors in function
- "Network error" - Check internet/Supabase status
Try deploying with verbose output:
npx supabase functions deploy [function] --debugCheck function logs after failed invocation:
npx supabase functions logs [function] --scroll
Health Check Failures
If health check fails but deployment succeeded:
- Function may need secrets - check Supabase dashboard
- Function may have runtime error - check logs:
npx supabase functions logs [function] - Function may need warm-up - try again in 30 seconds
Notification Channels
Console Output
Show progress for each function:
Deploying edge functions...
[1/3] create-oauth-profile
Deploying... done (8s)
Health check... PASS
[2/3] create-buyer-profile
Deploying... done (7s)
Health check... PASS
[3/3] create-creator-profile
Deploying... done (9s)
Health check... PASS
All 3 functions deployed successfully!
Slack Notification
{
"text": "Edge Functions Deployed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Edge Functions Deployed*\nGroup: auth\nFunctions: 3\nStatus: All healthy"
}
}
]
}
GitHub PR Comment
If deploying as part of a PR workflow:
## Edge Functions Deployment
Deployed 3 functions from `auth` group:
- create-oauth-profile
- create-buyer-profile
- create-creator-profile
All health checks passed.
Tips
- Deploy related functions together to avoid version mismatches
- Use
--skip-healthduring rapid iteration, but verify before production - After updating
_shared/code, redeploy all dependent functions - Check Supabase dashboard for detailed logs if issues occur
- Functions cold-start on first invocation - health check may be slow
Related Skills
/deploy-staging- Deploy apps to Vercel staging/safe-migrate- Run database migrations safely/health-check- Comprehensive system health monitoring