Skip to content

feat: enable webhooks by default #1152

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

feat: enable webhooks by default #1152

wants to merge 5 commits into from

Conversation

sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Aug 21, 2024

SQL migrated over from cli / api https://github.com/supabase/cli/blob/develop/internal/db/start/templates/schema.sql#L26
With improved retry support from @mansueli: https://github.com/supabase/infrastructure/pull/16831

Solves an immediate pain point with enabling webhooks. More context: https://supabase.slack.com/archives/C07E5GFAHTM/p1724229124279079

Upgrade path for existing projects can be done via ansible rollout as the migration is idempotent.

@sweatybridge sweatybridge force-pushed the webhooks branch 2 times, most recently from dcdfdfb to 98e75d9 Compare August 21, 2024 18:49
@sweatybridge sweatybridge marked this pull request as ready for review August 22, 2024 05:44
@sweatybridge sweatybridge requested review from a team as code owners August 22, 2024 05:44
@soedirgo
Copy link
Member

Please omit the retry changes for now, the Postgres team doesn't have the bandwidth to fix it if it goes south.

@steve-chavez would it be an issue to enable Database Webhooks by default once we package it as an extension?

@steve-chavez
Copy link
Member

@steve-chavez would it be an issue to enable Database Webhooks by default once we package it as an extension?

I'm a bit confused about this change. So this means that the supabase_functions schema will be created by default and not with a manual step on the dashboard?

If so, is certainly an improvement, but ideally we package supabase_functions as an extension and not a "migration". This is so we can control the SQL for debugging and upgrading. So far this has been impossible to do for me.

So could we move it to nix/ext/supabase_functions, make it a extension (v0.1) and make it depend on pg_net?

This would be a huge improvement.

@steve-chavez
Copy link
Member

So could we move it to nix/ext/supabase_functions, make it a extension (v0.1) and make it depend on pg_net?

If the above can be done without a breaking change later, I can help with it after I finish supabase/pg_net#139.

@sweatybridge
Copy link
Contributor Author

Yes, this removes the manual step from enabling on dashboard.

Enabling webhooks is also currently irreversible since we don't support disabling from dashboard. That's why I think it's ok to have it as a migration since we have to deal with the upgrade path for existing projects anyway.

But I agree a separate extension is better. I believe the supabase_functions schema is currently locked down to supabase_admin so it's safe to switch without breaking.

This webhook also creates the supabase_functions_admin role. Do we want to create it in the extension too?

@mansueli
Copy link
Member

mansueli commented Aug 23, 2024 via email

@steve-chavez
Copy link
Member

I believe the supabase_functions schema is currently locked down to supabase_admin so it's safe to switch without breaking.

Ok cool. Then this should be good to go.

This webhook also creates the supabase_functions_admin role. Do we want to create it in the extension too?

Haven't thought much about this, maybe the role creation and the privileges should remain as migration. I don't recall seeing a pg extension that creates roles (since they're global objects). But is something for later.

@soedirgo
Copy link
Member

pg extension that creates roles

pgsodium does this, but yeah agree that creating global objects in an extension is a bit awkward

Copy link
Contributor

@darora darora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't pg_net still seeing segfaults? Do we really want to enable it by default?

@steve-chavez
Copy link
Member

Isn't pg_net still seeing segfaults? Do we really want to enable it by default?

No more segfaults since https://github.com/supabase/pg_net/releases/tag/v0.9.3, those were fixed on supabase/pg_net#136.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants