Files
Vaibhav d5fde192d5 examples: migrate Edge Functions to @supabase/server (#46890)
- extends/supersedes: #46665 
- towards COM-269

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Standardized Edge Function entrypoints across examples to a consistent
`export default` shape, with runtime-provided admin access for
storage/database operations.
  * Updated public endpoint handling to use appropriate auth modes.
* **Bug Fixes**
* Improved error handling to return structured JSON responses with
correct HTTP status codes for invalid requests and failures.
  * Harmonized local invocation examples to use the right header format.
* **Chores**
* Updated example `verify_jwt` settings to disable JWT verification for
public/demo endpoints.
* **Documentation**
  * Fixed README typo and refreshed invocation curl examples.
* **Tests**
  * None.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Tomas Pozo <tomaspozogarzon@gmail.com>
2026-06-26 15:04:46 -05:00

23 lines
728 B
TypeScript

// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
import { withSupabase } from 'npm:@supabase/server@^1'
console.log('Hello from Functions!')
// Authenticated endpoint, so deploy with verify_jwt = true.
export default {
fetch: withSupabase({ auth: 'user' }, async (_req, _ctx) => {
const data = {
message: `I was deployed via GitHub Actions!`,
}
return Response.json(data)
}),
}
// To invoke:
// curl -i --location --request GET 'http://localhost:54321/functions/v1/github-action-deploy' \
// --header 'Authorization: Bearer <USER_ACCESS_TOKEN>'