cli
cli copied to clipboard
running webhooks on local development
Bug Report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When developing locally with Supabase webhooks, I'm unable to run the edge-function webhook using a local URL. When setting up the webhook in the remote DB with an edge function, it's intended to call an edge function anytime a row is inserted into a specified table. However, during local development, this behavior isn't replicated; instead, the webhook defaults to an HTTPS request. The option to use a native edge function (which is essentially an HTTPS URL) disappears. I'm looking for a seamless way to set the webhook URL to a local edge function during local development without manual intervention.
To Reproduce
-
Set up Supabase webhook in remote DB with an edge function.
-
Ensure the edge function is called whenever a row is added to a particular table.
-
Run the application in local development.
-
Observe that the webhook defaults to an HTTPS request instead of the intended edge function.
Expected behavior
When running local development, the webhook should be able to point to a local edge function, similar to how it operates in a production environment. The switch between local and production webhooks should be smooth, without needing manual adjustments.
Additional context
The primary goal is to maintain consistency between local and production environments. The current behavior makes local testing challenging due to the difference in how webhooks are handled.
I am facing similar issue. Right now only solution I could see is add a new migration file that override the local migration on Staging and Production.
That's what we did, just added it to seed.sql and did some stuff manually.
Facing same thing on local environment.
I am having issues myself but it is not related to https.
When running Supabase status
I get:
API URL: http://127.0.0.1:64321
GraphQL URL: http://127.0.0.1:64321/graphql/v1
DB URL: postgresql://postgres:[email protected]:64322/postgres
Studio URL: http://127.0.0.1:64323
Inbucket URL: http://127.0.0.1:64324
The base URL that I am using in my edge function is http://127.0.0.1:64321
. My test edge function that is running locally when I run the supabase functions serve
command has a URL path of functions/v1/update-instructor-ui
. So for the webhook URL, I am using http://127.0.0.1:64321/functions/v1/update-instructor-ui
.
I did the same setup and pattern in my cloud instance of supabase and it executed fine. The only difference is that in my cloud instance are the choices of webhook types to choose from.
Cloud Instance:
Local Instance:
I do not know if this has anything to do with it but I assume that it does and locally running supabase instances just simply do not have the feature to execute locally running edge functions yet.
Just like the above post, I have no issue executing the locally running edge function using Postman. If this is just not a feature of Supabase yet but will be eventually, I understand. If this is not planned yet though, I highly request that it be added. I love the idea of doing everything locally!! 👍🏼
This goes without saying though, highly impressed by Supabase so far and I am loving it!! 😉
Another update/additional info:
Since the web interface of the locally running Supabase instance makes it seem like it does not support edge functions, I decided to instead create a deno deploy project with a simple function. I created the deno function, deployed it from a GitHub repository, and verified that it could be invoked via Postman, the cloud Supabase instance, and the locally running Supabase instance.
It all worked perfectly fine. But as soon as I tried to use the local Supabase instance to invoke the deno function running locally, nothing happened. So it seems that the main issue here is that locally running Supabase instances cannot execute locally running functions.