Database API 42501 errors #31293
TheOtherBrian1
announced in
Troubleshooting
Replies: 1 comment
-
I am running a self-hosted instance. And running the query to show the errors does not return any data, however, it does throw the following error when viewing docker logs:
I also connected to the DB directly, but I can't seem to find
Following is my current config:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
Postgres 42501 errors, often reported by clients as 401 or 403 errors, imply the request lacked adequate privileges. They can be viewed in the log explorer by running:
They tend to be caused by one of the following factors.
Attempted to access a forbidden schema
API roles cannot access certain schemas, most notably
auth
andvault
. This restriction extends to Foreign Data Wrappers relying onvault
. While you can bypass it using a security definer function, these schemas are intentionally restricted for security reasons.Attempted to access a custom schema
If you created a custom schema, you will have to give the Database API permission to query it. Follow our Using Custom Schemas guide for more directions.
Revoked object level access:
In rare cases, users may accidentally revoke object-level access in
public
from their API roles. To regrant full visibility, run the below code:Configured column-level restrictions
If you've set column-based access in the Dashboard or via SQL, queries will fail with a
42501
error when accessing restricted columns. This includes usingselect *
, as it expands to include forbidden columns.RLS:
If the anon or authenticated roles attempt to UPDATE or INSERT values without the necessary RLS permissions, Postgres will return a 42501 error.
Beta Was this translation helpful? Give feedback.
All reactions