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.

Tables created via UI are not granted any access privileges

See original GitHub issue

Bug report

Describe the bug

Tables created via the Supabase UI do not have any access privileges granted and cannot be accessed using either client or service credentials.

To Reproduce

  1. Create a new table via the supabase UI with default settings (autogen ID and created_at columns). Leave the RLS option deselected.
Screen Shot 2021-10-14 at 10 06 35 PM
  1. Attempt to query the table via a. supabase-js client with client keys b. supabase-js client with service keys c. psql in all cases you will get a permission denied error.
{
  hint: null,
  message: 'permission denied for table test_table',
  code: '42501',
  details: null
}

Expected behavior

I should be able to select from a table which has no RLS using both client and service keys.

System information

  • Version of supabase-js: 1.20.0

Additional context

psql output below shows that the newly created test_table has no access privileges, but a table created via the UI in the past does have access privileges.

postgres=> \z test_table
                                           Access privileges
 Schema |    Name    | Type  | Access privileges | Column privileges |            Policies             
--------+------------+-------+-------------------+-------------------+---------------------------------
 public | test_table | table |                   |                   | Enable access to all users (r):+
        |            |       |                   |                   |   (u): true
(1 row)

postgres=> \z profile
                                                           Access privileges
 Schema |  Name   | Type  |       Access privileges        | Column privileges |                       Policies                        
--------+---------+-------+--------------------------------+-------------------+-------------------------------------------------------
 public | profile | table | postgres=arwdDxt/postgres     +|                   | Profiles are viewable by users who created them. (r):+
        |         |       | anon=arwdDxt/postgres         +|                   |   (u): (auth.uid() = uid)
        |         |       | authenticated=arwdDxt/postgres+|                   | 
        |         |       | service_role=arwdDxt/postgres  |                   | 

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
zacataccommented, Oct 15, 2021

My workaround for this issue was to grant privileges for this new table manually:

GRANT ALL ON TABLE public.test_table TO postgres;
GRANT ALL ON TABLE public.test_table TO anon;
GRANT ALL ON TABLE public.test_table TO authenticated;
GRANT ALL ON TABLE public.test_table TO service_role;
1reaction
soedirgocommented, Oct 16, 2021

Thanks, can you file a support request at https://app.supabase.io/support/new?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grant permissions to user for any new tables created in ...
Found the answer. It is in this line in the ALTER DEFAULT PRIVILEGES documentation. You can change default privileges only for objects that ......
Read more >
Group not inheriting access privileges for all tables
When I create a table as user a , the readonly user can access it. But when I create the table as user...
Read more >
Why can't role ACCOUNTADMIN access new tables created ...
Since this is a development user, it does not grant any privileges at all to other users or roles. Once development is complete, ......
Read more >
Granting Permissions to Database Objects - Civis Analytics
To revoke privileges from a database object, use the REVOKE command. Permissions for schemas and tables are separate. To grant access to “demo....
Read more >
How to manage the user access rights to see database views ...
A very simple way is to use the following T-SQL script that will create a database role, it will also add the views...
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