From 4363dbb975f565a6cbcdfded31c299109d7aff85 Mon Sep 17 00:00:00 2001 From: Lakshan Perera Date: Wed, 20 May 2026 05:53:47 +1000 Subject: [PATCH] Some trivial fixes to Edge Function guides (#46092) Was going through user feedback and fixed some of the minor issues with the guides. ## Summary by CodeRabbit * **Documentation** * Added guidance on handling CORS when invoking Edge Functions from the browser (quickstart and dashboard) * Updated Deno configuration guidance to reference a top-level deno.json and adjusted recommended project structure * Improved internal cross-references for templates and shared documentation links in functions guides [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46092?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) --------- Co-authored-by: Jeremias Menichelli --- apps/docs/content/guides/functions/cors.mdx | 2 +- .../content/guides/functions/development-environment.mdx | 4 ++-- .../examples/auth-send-email-hook-react-email-resend.mdx | 2 +- apps/docs/content/guides/functions/quickstart-dashboard.mdx | 6 ++++++ apps/docs/content/guides/functions/quickstart.mdx | 6 ++++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/docs/content/guides/functions/cors.mdx b/apps/docs/content/guides/functions/cors.mdx index 46d7c4375b7..2b48518de9c 100644 --- a/apps/docs/content/guides/functions/cors.mdx +++ b/apps/docs/content/guides/functions/cors.mdx @@ -52,7 +52,7 @@ This approach ensures that when new headers are added to the Supabase SDK, your #### For versions before 2.95.0 -If you're using `@supabase/supabase-js` before v2.95.0, you'll need to hardcode the CORS headers. Add a `cors.ts` file within a [`_shared` folder](/docs/guides/functions/quickstart#organizing-your-edge-functions): +If you're using `@supabase/supabase-js` before v2.95.0, you'll need to hardcode the CORS headers. Add a `cors.ts` file within a [`_shared` folder](/docs/guides/functions/development-environment#recommended-project-structure): ```ts _shared/cors.ts export const corsHeaders = { diff --git a/apps/docs/content/guides/functions/development-environment.mdx b/apps/docs/content/guides/functions/development-environment.mdx index 50b3c29fca8..4f75500e896 100644 --- a/apps/docs/content/guides/functions/development-environment.mdx +++ b/apps/docs/content/guides/functions/development-environment.mdx @@ -42,7 +42,7 @@ Set up your editor environment for proper TypeScript support, autocompletion, an ```json { "deno.enablePaths": ["./supabase/functions"], - "deno.importMap": "./supabase/functions/import_map.json" + "deno.importMap": "./supabase/functions/deno.json" } ``` @@ -76,7 +76,7 @@ It's recommended to organize your functions according to the following structure ```bash └── supabase ├── functions - │ ├── import_map.json # Top-level import map + │ ├── deno.json # Top-level Deno configuration │ ├── _shared # Shared code (underscore prefix) │ │ ├── supabaseAdmin.ts # Supabase client with SECRET key │ │ ├── supabaseClient.ts # Supabase client with PUBLISHABLE key diff --git a/apps/docs/content/guides/functions/examples/auth-send-email-hook-react-email-resend.mdx b/apps/docs/content/guides/functions/examples/auth-send-email-hook-react-email-resend.mdx index b43513e87fa..e21a4dfab24 100644 --- a/apps/docs/content/guides/functions/examples/auth-send-email-hook-react-email-resend.mdx +++ b/apps/docs/content/guides/functions/examples/auth-send-email-hook-react-email-resend.mdx @@ -116,7 +116,7 @@ Deno.serve(async (req) => { ### 3. Create React Email templates -Create a new folder `_templates` and create a new file `magic-link.tsx` with the following code: +Create a new `_templates` folder following the [recommended project structure](/docs/guides/functions/development-environment#recommended-project-structure) and add a new `magic-link.tsx` file with the following code: ```tsx supabase/functions/send-email/_templates/magic-link.tsx import { diff --git a/apps/docs/content/guides/functions/quickstart-dashboard.mdx b/apps/docs/content/guides/functions/quickstart-dashboard.mdx index 7fae4fc918f..4412d30a293 100644 --- a/apps/docs/content/guides/functions/quickstart-dashboard.mdx +++ b/apps/docs/content/guides/functions/quickstart-dashboard.mdx @@ -151,6 +151,12 @@ There is currently **no version control** for edits! The Dashboard's Edge Functi Now that your function is deployed, you can invoke it from within your app: + + +Make sure your function can handle [CORS](/docs/guides/functions/cors) (Cross-Origin Resource Sharing) requests by configuring its headers correctly. + + + + +Make sure your function can handle [CORS](/docs/guides/functions/cors) (Cross-Origin Resource Sharing) requests by configuring its headers correctly. + + +