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 example https://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

  1. Check the URL format. It's always:

    https://<project>.<instance>.supahost.space/functions/v1/<slug>
    

    For project app-one on instance acme and a function send-invoice: https://app-one.acme.supahost.space/functions/v1/send-invoice. With supabase-js, pass only the slug: supabase.functions.invoke('send-invoice').

  2. Check the slug. Slugs are lowercase letters, digits, - and _. sendInvoice and send-invoice are different. Compare with the list in Dashboard → your project → Functions tab.

  3. Check the status. In the Functions tab, the function must be active. If its only version is error, nothing is serving yet; fix the build and deploy again (see Edge Function deploy failed). A function that's still deploying also isn't live yet.

  4. Check the project. Make sure your app's SUPABASE_URL points at the project that has the function. Branches don't copy functions from their parent, so a branch needs its own deploy.

  5. 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.

Updated 11 November 2026 · View as Markdown · Something wrong or missing? Tell us