S
Supabase3y ago
Hadi

Could not query the database for the schema cache. Retrying.

Hey there I receive this error when i call supabase from supabasejs with anon key.
6 Replies
garyaustin
garyaustin3y ago
This is a PostgREST error (the database API Supabase uses). I've not seen it reported before. Can you provide more info on your Supabase environment (hosted, new, was working now not, etc.)
Hadi
HadiOP3y ago
It was working since yesterday, i think what is causing the problem is releated to db privileges, but not really sure what to fix Its hosted on Supabase cloud
garyaustin
garyaustin3y ago
Did you change the privileges/grants somehow?
Hadi
HadiOP3y ago
we did change lots of roles and tried not to touch any thing related to Supabase roles. is there a way to restore default privileges for Supabase roles?
garyaustin
garyaustin3y ago
No automatic way. The two roles that are critical for PostgREST with anon are anon and authenticator. https://github.com/supabase/supabase/issues/4833 discusses a bit on this. But I'm not sure best way to dig thru all the different setup/migration scripts to see what it is set. Maybe look at a new instance and see, but you need to know what you are doing. If you have alot invested you could try support, if not starting over might be fastest.
GitHub
Grant CONNECT permission to authenticator, supabase_storage_admin a...
Chore Describe the chore In order to tighten the security of a PostgreSQL instance, some suggest to revoke the permissions for the database and 'public' from the PUBLIC role and onl...
Hadi
HadiOP3y ago
Thanks 🙏🏼 , we'll try and see how it goes. We cant start over as the db connected to many services. And lots of users already using the app. Thanks for the advice, I looked at a new project and ran:
SELECT grantee, privilege_type
FROM information_schema.role_table_grants
WHERE table_name='pg_class';
SELECT grantee, privilege_type
FROM information_schema.role_table_grants
WHERE table_name='pg_class';
and found PUBLIC role does not have SELECT privilege in the old project. Fixed it with: GRANT SELECT ON pg_class TO PUBLIC;

Did you find this page helpful?