Persistent PGRST301 error on a TEXT primary key and I'm completely stumped.
Hey everyone! I'm running into a persistent PGRST301 error on a TEXT primary key and I'm completely stumped. I've been debugging this for a while and have tried everything I can think of, including a full project restart
The Goal:
I'm using Clerk for auth with the recommended webhook integration. An Edge Function creates a user in my public.profiles table, where the id is the Clerk User ID
When my client-side app queries the profiles table, it consistently fails.
My Setup:
*
public.profiles table has an id column of type TEXT.
* This id column is set as the PRIMARY KEY.
* My RLS policy for SELECT is correct for Clerk's JWTs:
What I've Already Tried (with no success):
* Rebuilding the Primary Key: I've run ALTER TABLE ... DROP CONSTRAINT profiles_pkey CASCADE, followed by re-adding the primary key and all the foreign key constraints. The script completes successfully.
* Forcing Schema Cache Reload: I've run NOTIFY pgrst, 'reload schema' after every schema change.
* Full Project Restart: I performed a full project restart via the Supabase dashboard. The error still persists.
* Verified Webhooks: The Clerk webhook is firing successfully and the user profile is being created perfectly in the profiles table. The data is definitely there.
I feel like I'm in a weird state where the database schema is correct, but the PostgREST API layer is working off a stale cache that a restart didn't even fix. Has anyone ever seen an issue this persistent? Is there another way to force the API schema to refresh that I'm missing? Any suggestions would be amazing.4 Replies
I think that error has to do with a bad JWT.

Thank you so much, you gave me exactly what I needed to troubleshoot the rest. I simply missed a step, adding Clerk as a sign in provider and pasting the URL from Clerk.
The JWT was valid and providing the right claims but Supabase wasn't seeing it as valid because of that one minor issue.
How do I send a coffee?
Appreciate the thought but Supabase compensates us mods for our time.
Ok, I really appreciate that you unblocked me. You're a superstar