Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: strip prefix in hookSecret, update docs and related examples (#39799)

Cemal Kılıç0e549e9ee558
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 be5464a72f7..b43513e87fa 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
@@ -41,7 +41,7 @@ import { renderAsync } from 'npm:@react-email/[email protected]'
import { MagicLinkEmail } from './_templates/magic-link.tsx'
const resend = new Resend(Deno.env.get('RESEND_API_KEY') as string)
-const hookSecret = Deno.env.get('SEND_EMAIL_HOOK_SECRET') as string
+const hookSecret = (Deno.env.get('SEND_EMAIL_HOOK_SECRET') as string).replace('v1,whsec_', '')
Deno.serve(async (req) => {
if (req.method !== 'POST') {
@@ -279,12 +279,12 @@ Store these secrets in your `.env` file.
```bash supabase/functions/.env
RESEND_API_KEY=your_resend_api_key
-SEND_EMAIL_HOOK_SECRET=<base64_secret>
+SEND_EMAIL_HOOK_SECRET="v1,whsec_<base64_secret>"
```
<Admonition type="note">
-You can generate the secret in the [Auth Hooks](/dashboard/project/_/auth/hooks) section of the Supabase dashboard. Make sure to remove the `v1,whsec_` prefix!
+You can generate the secret in the [Auth Hooks](/dashboard/project/_/auth/hooks) section of the Supabase dashboard.
</Admonition>
diff --git a/examples/edge-functions/supabase/.env.local.example b/examples/edge-functions/supabase/.env.local.example
index 7b1461f17bb..86bc165a625 100644
--- a/examples/edge-functions/supabase/.env.local.example
+++ b/examples/edge-functions/supabase/.env.local.example
@@ -1,6 +1,6 @@
# auth hook react email resend
RESEND_API_KEY=your_resend_api_key
-SEND_EMAIL_HOOK_SECRET=base64_secret
+SEND_EMAIL_HOOK_SECRET="v1,whsec_<base64_secret>"
# cloudflare-turnstile
CLOUDFLARE_TURNSTILE_SECRET_KEY=your_secret_key
diff --git a/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/README.md b/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/README.md
index 2e2639f8d78..1fe7f688185 100644
--- a/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/README.md
+++ b/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/README.md
@@ -8,5 +8,5 @@
```txt
RESEND_API_KEY=<your_resend_api_key>
-SEND_EMAIL_HOOK_SECRET=<base64_secret>
+SEND_EMAIL_HOOK_SECRET="v1,whsec_<base64_secret>"
```
diff --git a/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/index.ts b/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/index.ts
index 8f66c093e91..ecf988aff08 100644
--- a/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/index.ts
+++ b/examples/edge-functions/supabase/functions/auth-hook-react-email-resend/index.ts
@@ -6,7 +6,7 @@ import { MagicLinkEmail } from './_templates/magic-link.tsx'
import { SignUpEmail } from './_templates/sign-up.tsx'
const resend = new Resend(Deno.env.get('RESEND_API_KEY') as string)
-const hookSecret = Deno.env.get('SEND_EMAIL_HOOK_SECRET') as string
+const hookSecret = (Deno.env.get('SEND_EMAIL_HOOK_SECRET') as string).replace('v1,whsec_', '')
Deno.serve(async (req) => {
if (req.method !== 'POST') {