This guide covers the deployment and configuration of Supabase Edge Functions for the LightShowVault project.
The following environment variables must be set in your Supabase project:
# Required for email notifications
RESEND_API_KEY=your_resend_api_key
# Required for authentication
SUPABASE_URL=your_project_url
SUPABASE_ANON_KEY=your_anon_key- Go to your Supabase project dashboard
- Navigate to Settings > API
- Click on "Edge Functions"
- Add each environment variable under "Config Vars"
This function handles sending email notifications when new quote requests are submitted.
- Deploy the function:
supabase functions deploy send-quote-notification-
Enable HTTP requests:
- Go to your Supabase dashboard
- Navigate to Edge Functions
- Find "send-quote-notification"
- Enable "Invoke function via HTTP"
-
CORS Configuration:
- The function includes built-in CORS headers
- Allows requests from any origin (
*) - Supports
POSTandOPTIONSmethods - Allows required headers:
authorization,x-client-info,apikey,content-type
- Resend API key
- Supabase project URL and anon key
- cURL or similar HTTP client
- Test with cURL:
curl -X POST 'https://[PROJECT_REF].supabase.co/functions/v1/send-quote-notification' \
-H "Authorization: Bearer [ANON_KEY]" \
-H "Content-Type: application/json" \
--data '{
"record": {
"name": "Test User",
"email": "test@example.com",
"phone": "+1234567890",
"timeline": "1-2 months",
"budget": "5k-10k",
"notes": "Test request"
}
}'- Expected Success Response:
{
"success": true
}- Common Error Responses:
Missing/Invalid Authorization:
{
"success": false,
"error": "Missing or invalid authorization header"
}Unauthorized:
{
"success": false,
"error": "Unauthorized"
}Email Send Error:
{
"success": false,
"error": "Failed to send email"
}- Check your admin email (dudesonwill@gmail.com) for the notification
- Verify the email contains:
- Quote request details
- Customer contact information
- Timeline and budget information
- Any provided notes
- Link to admin dashboard
-
Check Supabase Logs:
- Go to your project dashboard
- Navigate to Edge Functions
- Select the function
- Click on "Logs"
-
Common Issues:
- Missing environment variables
- Invalid Resend API key
- Network connectivity issues
- CORS configuration problems
-
Debug Steps:
- Verify environment variables are set correctly
- Check function logs for detailed error messages
- Ensure the authorization token is valid
- Test with minimal request payload first
- Verify Resend API status at status.resend.com