question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"permission denied for schema net" after enabling hook functions alpha

See original GitHub issue

Bug report

Describe the bug

Enabling Hook functions results in a collection of permission related errors when calling supabase.from("table").insert({ ...data }) or supabase.from("table").update({ ...data }) on a table with an associated hook which runs on inserts/updates.

Examples include:

“permission denied for schema net” “permission denied for schema supabase_functions” “permission denied for table http_request_queue”

To Reproduce

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

  1. Create a new Supabase project
  2. Go to ‘Database’ -> ‘Function Hooks’
  3. Click ‘Enable Hooks’
  4. Create a new hook that fires on any event against an existing table in the public schema
  5. Try to perform an operation on this table using the Supabase JS client, e.g. supabase.from("profiles").update({ email: "some@email.com" })
  6. Check the network request response in your browser

Expected behavior

When enabling hooks, appropriate privileges should be created on all necessary schemas / tables / sequences.

System information

  • Version of supabase-js: 1.21.0

Additional context

I’ve resolved the issue by manually granting privileges through the SQL editor in the dashboard:

GRANT USAGE ON SCHEMA net TO "authenticated";
GRANT ALL ON ALL TABLES IN SCHEMA net TO "authenticated";
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA net TO "authenticated";

GRANT USAGE ON SCHEMA supabase_functions TO "authenticated";
GRANT ALL ON ALL TABLES IN SCHEMA supabase_functions TO "authenticated";
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA supabase_functions TO "authenticated";

However, I have no idea if these are the correct permissions/privileges, they just seem to work and from what I can tell mirror the privileges on tables within the storage schema!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
w3b6x9commented, Dec 24, 2021

@Marc-Hoch please email support@supabase.io with a link to this discussion and your project ref. We’ll investigate!

0reactions
rbkayzcommented, Sep 28, 2022

@w3b6x9 Wen, facing the same issue here. Have already mailed to support, but would you have a solve here

Error is occuring if I try to modify a table with a function - it says permission denied for schema supabase_functions

Thanks a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permissions denied for table using API but works with ... - GitHub
My finding: It seems to be connected with the functions hooks ALPHA. After removing the hooks for the table that throws the error...
Read more >
postgres: permission denied for schema
this solves it: postgres=# \connect ip_spotlight You are now connected to database "ip_spotlight" as user "postgres". ip_spotlight=# GRANT ...
Read more >
PostgreSQL ERROR: permission denied for schema public
Public schema default permissions changed in PostgreSQL 15 - it might hurt you during application deployment. Here's what to do.
Read more >
Admission Controllers Reference - Kubernetes
Several important features of Kubernetes require an admission controller to be enabled in order to properly support the feature.
Read more >
Firebase JavaScript SDK Release Notes - Google
Fixed a bug that threw a FAILED_PRECONDITION error when writing to a deleted document ... listeners to stop working and receive a "Permission...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found