Skip to content

gonzalo-smtv/peaq-sdk-supabase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supabase Edge Functions Guide

Prerequisites

  • Supabase CLI installed (npm install -g supabase)
  • Deno installed (required for Edge Functions)

Local Development

Start Supabase Local Instance

supabase start

Create a New Edge Function

supabase functions new my-function-name

Start Edge Functions

supabase start

Check Edge Functions Logs

docker logs -f supabase_edge_runtime_peaq-supabase

Stop Edge Functions

supabase stop

Deployment

Deploy All Functions

supabase functions deploy

Deploy Specific Function

supabase functions deploy my-function-name

Testing

Test Locally

# POST request
curl -i --location --request POST 'localhost:54321/functions/v1/my-function-name' \
    --header 'Authorization: Bearer YOUR_ANON_KEY' \
    --header 'Content-Type: application/json' \
    --data '{"name":"Functions"}'

Test Deployed Function

# Replace YOUR_PROJECT_REF with your Supabase project reference
curl -i --location --request POST 'https://YOUR_PROJECT_REF.functions.supabase.co/my-function-name' \
    --header 'Authorization: Bearer YOUR_ANON_KEY' \
    --header 'Content-Type: application/json' \
    --data '{"name": "test"}'

Deploy env variables

supabase secrets set --env-file .env

Important Notes

  • Edge Functions run on Deno runtime
  • Local development requires Supabase CLI version 1.0.0 or higher
  • Functions and environments must be deployed to be accessible in production

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published