Clerk and Supabase Storage - UUID issue
I see a closed post from a year ago but I am facing the same issue.
Using the new Clerk integration for 3rd party auth.
Works fine for all database actions
But on storage I get StorageApiError: delete from "objects" where "bucket_id" = $1 and "name" in ($2) returning * - invalid input syntax for type uuid: "user_2n1K77zlgJ......"
I understand this is because storage has an owner column that is uuid and Clerk uses Text for user_id (but this is going to owner_id anyway).
Anyone else come across this? Sure it is something I am doing as must be a common use case.
2 Replies
@iamcharliecowan use a Supabase JWT template in Clerk that sets a valid UUID in the sub claim.
Update your Supabase Storage policies to reference auth.uid() instead of the owner column if needed
Ah awesome I will try that - thanks for the swift reply.