SupabaseS
Supabase3mo ago
Burhan

Auth Hook for Email Confirmation Not Working - Base64Decoding Error

Issue Summary
I'm trying to set up email confirmation using Supabase Auth Hooks with a custom Edge Function (send-confirmation-email), but getting a persistent hook_timeout error during user signup. The Edge Function logs show: Error: Base64Coder: incorrect characters for decoding when trying to verify the webhook signature.

Setup Details

  1. Auth Hook Configuration
(Authentication → Hooks → Send email)
  • HTTP Method: POST
  • HTTP URL: https://{projectId}.supabase.co/functions/v1/send-confirmation-email
  • Secret: Generated using "Generate a secret" button (format: whsec_xxxxxxxxxxxxx)
  • Events: "Validate" checked
  1. Auth Provider Configuration
(Authentication → Providers → Email)
  • Email provider enabled
  • "Confirm email" enabled
  • "Secure email change" enabled
  1. Edge Function Configuration
(Project Settings → Edge Functions)
  • SEND_CONFIRMATION_EMAIL_HOOK_SECRET secret added
  • Contains the exact same whsec_xxxxxxxxxxxxx value from Auth Hook configuration
  • No extra whitespace or line breaks
  • Waited 2-3 minutes after updating before testing
  1. supabase/config.toml

[functions.send-confirmation-email]
verify_jwt = false

[auth.email]
enable_signup = true
enable_confirmations = true


Error Details


User-facing error:
{
    "code": "hook_timeout",
    "message": "Failed to reach hook within maximum time of 5.000000 seconds"
}


Edge Function logs (most recent):
Error in send-confirmation-email function: Error: Base64Coder: incorrect characters for decoding
    at r.decode (https://esm.sh/@stablelib/base64@1.0.1/es2022/base64.mjs:2:2488)
    at Object.j [as decode] (https://esm.sh/@stablelib/base64@1.0.1/es2022/base64.mjs:2:3218)
    at new t (https://esm.sh/standardwebhooks@1.0.0/es2022/standardwebhooks.mjs:3:2086)
    at Object.handler (file:///tmp/user_fn_buaqpwzeebdronqkvcvx_78bb3461-bc0b-4d80-80c2-3ea1e24be113_4/source/supabase/functions/send-confirmation-email/index.ts:18:16)
Was this page helpful?