📄 SKILL.md

← Vault

name: supabase-edge-functions-esm-sh-fix

description: Fix BOOT_ERROR on Supabase Edge Functions caused by external imports (esm.sh, unpkg, etc.) when the native Deno fetch and Supabase Auth REST API can be used instead

category: devops


Supabase Edge Functions — BOOT_ERROR from External Imports

Symptoms


Key Insight

Browser console shows CORS error, but the root cause is BOOT_ERROR on the server. The browser's CORS preflight fails because the function body never executed — it returned an error before the CORS headers were set. Always test the function directly with curl first, not from the browser.

On self-hosted: BOOT_ERROR = function container running but code has import issue. Proxy error = function container not running at all.

Testing auth functions — When testing admin-reset-user-password or admin-update-user-email, you need a real JWT from a login session. The anon key alone is NOT enough for auth validation. Get a token via:

`bash

TOKEN=$(curl -s -X POST "https://PROJECT.supabase.co/auth/v1/token?grant_type=password" \

-H "apikey: $ANON_KEY" -H "Content-Type: application/json" \

-d '{"email":"admin@example.com","password":"PASS"}' | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

`