path of what/where exactly?
# javascript
n
path of what/where exactly?
g
probably should start here: https://supabase.io/docs/guides/storage
n
But im trying to upload files through my web app not through the supa base ui
this is what im following ^
i just dont understand the path part i guess
"The relative file path. Should be of the format folder/subfolder/filename.png. The bucket must already exist before attempting to upload."
s
https://supabase.io/docs/guides/storage#upload-a-file - there's a
JavaScript
tab on most examples
g
yes use the javascript options, but more you need to read up on buckets and paths as you have to tell the system where to store the file
The pathname is anything you want but must be unique. It can look like directory/filename.ext, but that is up to you.
n
getting a 404 error now
i created a folder in the supabase dashboard
just to test it out
g
then path would be folder/makeupaname.optional
n
thats how I have it in my code
and I get a 404
g
is the folder name "folder" ?
n
yes lol
just to test
i get a 404 error in the console and i get an error from supabase saying [object Object]
very strange
s
Console log the error. Alerts don't typically show the full error details properly.
g
Well your format looks good, so you might check you if have polices set wrong
n
Yep you guys are right its some type of policy
not sure what it means, i dont have any policies so do i need to create one?
g
in the UI there is a policy section under storage you have to set up for read/write/ etc
You have to set policies the tutorial has a section on security that might help
n
where can I find that? Can you link it?
g
https://supabase.io/docs/guides/storage#add-security-rules but you probably might also review RLS (row level security) for the database also. I don't remember how easy the UI was.
s
It used to be fairly plain, but I believe they added RLS templates a few months ago to make it easier for developers less familiar with Supabase
n
Also my bucket is public, shouldnt policies not even be an issue?
g
Two parts.
n
wdym?
got a new error after messing around with polices
"Key is not present in table "buckets"."
"insert or update on table "objects" violates foreign key constraint "objects_bucketId_fkey"
i made a typo with the bucket name...
this whole time
im so sorry
thank you so much for the help everyone
🤣
g
Well, you had other issues to start so got thru those before the "bucket name" issue. You asked two parts wdym.... basically buckets are an AWS S3 concept and Supabase uses those for storage. Public/Private has to do with URL's and access to those with just URL (I believe). The RLS is the database side Supabase added to check uid's, etc. https://supabase.io/blog/2021/03/30/supabase-storage has a better view of what is going on.