expresssupabase

Supabase edge function with framework 404


I'm trying to use Express (or any other framework for that matter) with Supabase Edge Functions, however i'm getting a 404 when hitting any route that has been configured.

I followed the exact instructions outlined here. Note that I didn't share my code because I copy-pasted the code in the doc and didn't change anything.

I get this error both when serving the function locally and when deploying it.

According to the Edge Functions dashboard, it says that the function has been invoked but gives the 404.

Is there something that needs to be done which is not highlighted in the doc that I linked or something else all together?

Also note that if I don't use a framework it works...


Solution

  • I figured it out - the docs mention this but they don't really show it in the code example.

    Let's say your function is called api and the route you want to provide is /user/:userId the route that you should have in your express routing is /api/user/:userId rather than just /user/:userId.

    The docs use a function called hello-world, but since that doc is about handling routes it would have made more sense to have an actual route there too, such as /hello-world/hello to demonstrate that the function name is needed along with the route you want to handle