cli: Schema supabase_functions does not exist (local development)

Bug report

Describe the bug

When trying to create a Database Webhook function in my local Supabase Studio, I get the following error: Failed to create hook: schema "supabase_functions" does not exist

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Start local supabase dev environment supabase start (while Docker is running)
  2. Open the local Supabase Studio (http://localhost:54323/project/default)
  3. On the left menu, go to Database
  4. Select Webhooks, enable them in Alpha and create a test webhook
  5. See error Failed to create hook: schema "supabase_functions" does not exist

Expected behavior

The Database Webhook should have been created correctly

Screenshots

image

System information

  • OS: Windows 10
  • Browser (if applies) Chrome
  • Version of Supabase CLI: 1.40.1 (latest available in Scoop as of today)

Additional points

  1. When doing it on the cloud instance, the Database Webhook is created correctly. If I then go to Table Editor => Schema supabase_functions -> Table hooks I see it empty. Is this correct? From the error above I assumed created Webhooks would be stored there. I see the Webhook in Database => Webhooks though.
  2. Are Webhooks captured as part of migrations and added to the sql file when a new migration is created?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

@Pictor13 @kingraphaii I got this issue but it was solved by enabling webhooks in destination database.

Yes, you can enable it via config.toml. For eg.

[experimental.webhooks]
enabled = true

Is there a way to enable webhooks programmatically or via the sql script?

I am running supabase migration up on my test container using image supabase/postgres:15.1 and the migration requiring webhooks is failing every time.

@thibaudlef where exactly did you enable it, please?

In the platform, navigate to “Database” from sidebar -> “Webhooks” under platform section & enable it

Its not happening to me locally but in GitHub actions. This is the migration command

CREATE TRIGGER revalidate_index AFTER INSERT OR DELETE OR UPDATE ON public.<TABLE> FOR EACH ROW EXECUTE FUNCTION supabase_functions.http_request('<HTML>', 'GET', '{"Content-type":"application/json"}', '{"secret":"TOKEN"}', '1000');

and my ci.yaml looks like this

name: CI

on:
  pull_request:
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3

      - uses: supabase/setup-cli@v1

      - name: Start Supabase local development setup
        run: supabase start

      - name: Verify generated types are up-to-date
        run: |
          supabase gen types typescript --local > supabase/types.ts
          if [ "$(git diff --ignore-space-at-eol types.ts | wc -l)" -gt "0" ]; then
            echo "Detected uncommitted changes after build. See status below:"
            git diff
            exit 1
          fi

And the error I get on running the migration is

Error: ERROR: schema "supabase_functions" does not exist (SQLSTATE 3F000)

Hi @mousindev , did you ever find a solution to this on local dev?

Hi, thanks for the fix! I see Scoop is still few versions behind (1.40.1) as of now compared to NPM updated yesterday to 1.42.7. Any timeline on when will Scoop be updated?

Thanks!