supabase / storage

S3 compatible object storage service that stores metadata in Postgres
https://supabase.com/docs/guides/storage
Apache License 2.0
764 stars 107 forks source link

Unable to create `createUploadSignedUrl` with `upsert` #502

Closed softmarshmallow closed 3 months ago

softmarshmallow commented 3 months ago

Improve documentation

Link

Describe the problem

[All using service role]

calling createSignedUploadUrl on existing object will give me below.

{
    "data": null,
    "error": {
        "name": "StorageApiError",
        "message": "The resource already exists",
        "status": 400
    }
}

https://github.com/supabase/storage/pull/460 states that I can upsert existing url with upsert: true (and also stated in document)

I also tried using createSignedUrl - this works for creating signed url on existing object, but will only return signedUrl, not token and path, which uploadToSignedUrl needs.

if I try direct upload via fetch, it will complain authrorization header is missing (which the successful createSignedUploadUrl's signedUrl will just work)

Describe the improvement

Document lacks example on upserting (updating) on client side for large files

Additional context

The reason I need signed url for update, not directly updating from client via update() is because, My app acts as a supabase admin wrapper and the auth is handled by other guards, not by rls / bucket policy

fenos commented 3 months ago

Hi @softmarshmallow, We have released a new version of the Supabase SDK that contains that flag, we missed that CI was failing and wasn't published previously.

It should work now

softmarshmallow commented 3 months ago

Hi. @fenos is the doc up-to-date?

https://supabase.com/docs/reference/javascript/storage-from-createsigneduploadurl

There is still no upsert option here.

Thank you : )

ahmadawais commented 2 months ago

Any updates on this, we need to replace a file on upload using signed URL as well and the docs have no ref on how to do this.

@fenos