-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dynamic S3 bucket doesnt work with Google Drive provider #4763
Comments
Actually getKey is also not passed any req:
I think this was intentional, because the req object is not stored inside the Uploader object because the Uploader lives outside the lifetime of a http request. And passing the whole req object feels like a leaky abstraction because IMO req contains internal data structures that might change at any time. But I agree that we could pass metadata to getBuckry, as well as other useful data, but not the whole req object I think |
@mifi how it is possible to pass bucket name from Uppy (Frontend) -> Companion (BackEnd) ? One way was to pass as Uppy's Metadata param but it is only passed to companion when aws-s3 is using the legacy uploader, which does not support bucket as a function. Or am I missing the flow, cause with aws-s3-multipart it first make request to backend s3/ endpoint to get creds and bucket name without passing anything custom from Uppy. Even param |
Hey. I just tested s3 multipart upload from google drive as well as from a local file, and it does correctly set metadata on the uploaded s3 object. correct me if I'm wrong @Murderlon but I think this is how users are supposed to pass data from Uppy to Companion. As for directly passing the bucket name to which to upload to from the client, I think that is not very safe because someone could abuse it to make your companion server upload to other arbitrary buckets |
@mifi you are describing slightly different issue. Im not trying to set metadata on the s3 object itself, but pass some meta info down to We dont have to pass a bucket name explicitly, but I could chose a bucket based on the metadata that is passed from the UI. |
Ok, so if I understand you correctly, you want to pass some side-metadata that should not be stored on the uploaded file, only to be used by companion user-code, passed into getBucket/getKey? @arturi @Murderlon wdyt, does it make sense to invent such a new concept of side-metadata? And what should we name it? also, how/when do you want to be able to attach this metadata in Uppy? On a per file-basis, right? |
Wouldn't aligning the |
ok let's do that first. created a PR #4770 |
Initial checklist
Link to runnable example
No response
Steps to reproduce
Im trying to set a bucket for S3 clien in companion dynamically based on the metadata set from the client. However, when upload is done through Google Drive (or any other provider),
bucket
function property on the companion does not receive any arguments.this is my rought setup
UI:
Companion:
I actually traced down the issue to this line:
https://github.com/transloadit/uppy/blob/main/packages/%40uppy/companion/src/server/Uploader.js#L658
it doesn't seem that a request object is passed down to
getBucket
util.In fact, it would be very helpful if
getBucket
passedthis.options.metadata
as a second argument (similar togetKey
).Expected behavior
Bucket property as a function should receive a request object when used with server-to-server providers.
Additionally, it would be nice if it could receive
options.metadata
just likegetKey
.Actual behavior
argument
req
of function propertybucket
on companion is undefined.The text was updated successfully, but these errors were encountered: