supabase/storage-js

Storage .list() method not seem to be working

thesyedbasim opened this issue · 1 comments

Bug report

Describe the bug

The .list() method in supabase.storage.from('') is not seem to be working.

  • I have data in my storage bucket
  • There is no error shown, only empty data
  • Storage bucket has no RLS
  • The path is correct, I even tried the root path but it's still not working

To Reproduce

You can copy this snippet and add it to your code which is connected to supabase.

const { data, error } = await supabase.storage
	.from('images')
	.list(`products/${productId}`);

if (error) {
	console.error(error);
}

Expected behavior

List of all images should be returned.

System information

  • OS: Windows 10
  • Browser: Chrome
  • Version of supabase-js: 1.29.4
  • Version of Node.js: 16.13.1
inian commented

Hey @thesyedbasim, by default storage buckets are private and have RLS turned on. If you want to list objects from the bucket, the user must have the appropriate read policy attached or use the service role key to completely bypass access control for the bucket.