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

Can not integrate Lock Objects S3 with Supabase #423

Closed FeliisraCeleri closed 5 months ago

FeliisraCeleri commented 8 months ago

Bug report

Describe the bug

I am using S3 integrated with supabase to save my files. I want to configure Lock Objects in my S3 Bucket, but i fails when try to save files via Supabase SDK.

I have this error message:

{"error":{"raw":"{\"name\":\"Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters\",\"httpStatusCode\":400,\"userStatusCode\":400,\"originalError\":{\"name\":\"InvalidRequest\",\"$fault\":\"client\",\"$metadata\":{\"httpStatusCode\":400,\"requestId\":\"KQ7VK13MMPSQH89E\",\"extendedRequestId\":\"fWidPboCY3akHUhFakfzno/A7zsV40ek6f2dNka+wRB02WC/F2NiuAJTD2PU71tQDCfSGpSum0A=\",\"attempts\":1,\"totalRetryDelay\":0},\"Code\":\"InvalidRequest\",\"RequestId\":\"KQ7VK13MMPSQH89E\",\"HostId\":\"fWidPboCY3akHUhFakfzno/A7zsV40ek6f2dNka+wRB02WC/F2NiuAJTD2PU71tQDCfSGpSum0A=\",\"message\":\"Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters\"}}","name":"Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters","message":"InvalidRequest","stack":"Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters: InvalidRequest\n    at StorageBackendError.fromError (/app/dist/storage/errors.js:46:16)\n    at S3Backend.uploadObject (/app/dist/storage/backend/s3.js:113:48)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Uploader.upload (/app/dist/storage/uploader.js:55:36)\n    at async ObjectStorage.uploadNewObject (/app/dist/storage/object.js:30:35)\n    at async Object.<anonymous> (/app/dist/http/routes/object/createObject.js:42:46)"},"msg":"celeri-qa | POST | 400 | 10.241.2.76 | req-1 | /object/CELERI_AR/7f2e93a4-d7fb-44ff-a2b6-1d5e6e240d35_core-front_git_flow.png | undici"}

Something similar to this issue --> https://github.com/aws/aws-sdk-php/issues/1694

To Reproduce

Try to integrate S3 Lock Objects with Supabase and save a file.

Expected behavior

I have Lock Objects configurated in S3 and still can save files via Supabase.

Screenshots

image

You can add here the header that is missing from Lock Objects S3 integration.

fenos commented 8 months ago

@FeliisraCeleri uploading files with LockObjects is not currently supported in Supabase Storage

It is not something on the roadmap at the moment, however, feel free to draft a PR if you'd like

fenos commented 8 months ago

The reason this doesn't work out of the box is because the server will need to compute the checksum of the file before uploading. This means that the file needs to be saved on disk first, to be able to compute the checksum, then uploaded to S3, currently, the upload is streamed directly to S3

fenos commented 5 months ago

Closing this, as this feature is not on our current radar