Project-specific PostgREST schema cache stuck – PGRST002 errors
Here’s a fully Markdown-formatted version you can copy-paste directly:
json
{
"response": {
"error": {
"code": "PGRST002",
"details": null,
"hint": null,
"message": "Could not query the database for the schema cache. Retrying."
},
"data": null,
"count": null,
"status": 503,
"statusText": "Service Unavailable"
}
}
sql
select * from packages_schema.general;
ts
const supabase = createClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_ANON!,
{ db: { schema: "packages_schema" } }
);
const { data, error } = await supabase.from("general").select("*");
This is concise, readable, and ready to paste into Supabase support.
```
```
24 Replies
You likely have the API turned off.
Do you have your custom schema added to the API settings?
yes
i already added schema. i dont have any changes on my side it was working few days back now its not

Is the API turned on?
What is the status of PostgREST in upper rate of instance homepage?


Try a restart I guess. All that looks good.
did 2 times
Instead of using the schema option in the createClient can you do that with .schema('myschema').from('xxxx') instead as a test without major impact? I don't know of an issue with the createClient way, but not as common these days.
I would expect a grant error if you did not set up your schema correctly, but maybe the error has changed.
Is the role granted access to your schema?
Check the Postgres logs.
on aug 13-16 --> working
no code changes all backends were deployed and working
aug 17-19 same code but now its not working
So nothing in the Postgres logs?
What version of postgres?
I've got no other ideas for you.
Do you have a support request in?
iam on free plan so they dont provide team support so i reached community support and asked here
If your instance is messed up only they can solve it.
I'm not saying it is though.
Hard to debug as that error is very general.
Try SQL impersonation for the schema.
you sure that will fix
I'm asking you to use the SQL editor impersonating the role you app call is using.
I want to see if you get any sort of grant error.
packages_schema is granted



In the SQL editor at bottom right see the user role. Change that to authenticated. Then select from packages_schema.general in the SQL editor.
i get data

how do i reach to the internal tech team for solution chatgpt is saying

You have to go thru support
Are you on latest version of Postgres? Upgrading also upgrades PostgREST.
Also try changing the API settings by removing the schema, save it, then adding it back in.
yes i did this just to be on the safe side after doing that i came to you
i don't know how to do that
Go to the infrastructure tab in settings.