© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
alx90

Upload to public storage - Invalid JWT

Hey there I created a simple public bucket. When I trying to upload a file via:
const { data, error } = await supabase.storage
    .from("mybucket")
    .upload("public/avatar1.png", req.body.file);
const { data, error } = await supabase.storage
    .from("mybucket")
    .upload("public/avatar1.png", req.body.file);

Im getting this error response:
{
  statusCode: '401',
  error: 'Invalid JWT',
  message: 'new row violates row-level security policy for table "objects"'
}
{
  statusCode: '401',
  error: 'Invalid JWT',
  message: 'new row violates row-level security policy for table "objects"'
}

Im not set any policies. My policies are totally empty.

[UPDATE]: I executed this SQL query:
-- 1. Allow public access to any files in the "public" bucket
create policy "Public Access"
on storage.objects for select
using ( bucket_id = 'mybucket' );
-- 1. Allow public access to any files in the "public" bucket
create policy "Public Access"
on storage.objects for select
using ( bucket_id = 'mybucket' );

Still the same error :/

Some ideas what to do ?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Invalid Jwt
SupabaseSSupabase / help-and-questions
6d ago
invalid jwt
SupabaseSSupabase / help-and-questions
2w ago
Invalid JWT
SupabaseSSupabase / help-and-questions
2mo ago
Invalid JWT
SupabaseSSupabase / help-and-questions
4y ago