Edge Function returns 404
Fix 404 responses from SupaHost Edge Functions: NOT_FOUND from the router, a wrong URL or slug, a function that never deployed, or a 404 returned by your own routing code.
What you see
A call to your function returns 404. There are three different 404s, and the response tells you which one you hit:
HTTP/2 404
sb-error-code: NOT_FOUND
HTTP/2 404
no Route matched with those values
Or a 404 with no sb-error-code header and a body your own code produced.
Why it happens
sb-error-code: NOT_FOUND: the request reached the function router, but no active function has that slug in this project. The slug is misspelled, the function was deleted, its first deploy failed so no version is live, or you're calling the wrong project.no Route matched with those values: the path didn't start with/functions/v1/, so the gateway didn't send it to functions at all. For examplehttps://app-one.acme.supahost.space/send-invoice.- No
sb-error-code: your function ran and returned 404 itself, usually because its internal router didn't match the path it received.
How to fix it
Check the URL format. It's always:
https://<project>.<instance>.supahost.space/functions/v1/<slug>For project
app-oneon instanceacmeand a functionsend-invoice:https://app-one.acme.supahost.space/functions/v1/send-invoice. With supabase-js, pass only the slug:supabase.functions.invoke('send-invoice').Check the slug. Slugs are lowercase letters, digits,
-and_.sendInvoiceandsend-invoiceare different. Compare with the list in Dashboard → your project → Functions tab.Check the status. In the Functions tab, the function must be
active. If its only version iserror, nothing is serving yet; fix the build and deploy again (see Edge Function deploy failed). A function that's stilldeployingalso isn't live yet.Check the project. Make sure your app's
SUPABASE_URLpoints at the project that has the function. Branches don't copy functions from their parent, so a branch needs its own deploy.Debug your own routing. If the 404 came from your code, log the path your handler sees and adjust your matching:
Deno.serve((req) => { const { pathname } = new URL(req.url) console.log('path received:', pathname) if (pathname.endsWith('/health')) return new Response('ok') return new Response('Not found', { status: 404 }) })The log line appears in the Functions tab's Logs card.
On SupaHost
The router answers NOT_FOUND with JSON and the sb-error-code header. If a project has no functions at all yet, /functions/v1/* also returns a 404 JSON response. Custom domains work too: once a custom domain is active, https://api.yourapp.com/functions/v1/<slug> reaches the same function.