transloadit / uppy-server

[DEPRECATED] 'Uppy Server' was renamed to 'Companion' and lives inside the Uppy repo no
https://github.com/transloadit/uppy/tree/master/packages/%40uppy/companion
MIT License
114 stars 27 forks source link

Uploading files to S3 after pulling them from Dropbox results in "Bucket POST must contain a field named 'key'" AWS error #57

Closed manuelkiessling closed 6 years ago

manuelkiessling commented 6 years ago

Hi,

I'm running uppy-server 0.10.1 in standalone mode. I got the S3 uploader working for local files (i.e., I can successfully drop local files into the Dashboard and they are successfully uploaded to my S3 bucket, with uppy-server doing the signing).

I also got the Dropbox integration working, that is, I can successfully browse and select my Dropbox files with the Dashboard.

What is NOT working is the upload of files I have selected with the Dropbox plugin to S3. uppy-server successfully pulls the files from Dropbox to its local file system, but when it tries to upload the files to S3, it errors at https://github.com/transloadit/uppy-server/blob/82cfa47adca4b0df0ceaf94ad442924aa814c6c9/src/server/Uploader.js#L221

I console.dir'd the response from AWS, and it says:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>InvalidArgument</Code>
  <Message>Bucket POST must contain a field named 'key'.  If it is specified, please check the order of the fields.</Message>
  <ArgumentName>key</ArgumentName>
  <ArgumentValue></ArgumentValue>
  <RequestId>...</RequestId>
  <HostId>...</HostId>
</Error>

You can see the full content of response.request at https://gist.github.com/manuelkiessling/3b4d1450624610d505c918501acb1a4a.

ifedapoolarewaju commented 6 years ago

Hi @manuelkiessling the S3 plugin is currently not setup to work for remote uploads yet. What is most likely happening is that uppy-server is trying to do a direct upload to S3 without the signed data. And S3 errors as a result of that

manuelkiessling commented 6 years ago

Hi @ifedapoolarewaju, thanks for clearing this up. I really think that the uppy docs could use some kind of "here are the different technical use cases that are possible" section. They are mostly clear, but only mostly, and only implicitly. I will try to find the time to write it and send a merge request.

Do I understand it correctly that as of now, the only way to get files from Dropbox into an S3 bucket is by having uppy with uppy-server pull the files to the local file system of uppy-server, and then to upload them to S3 with my own solution? But how, then, would I teach uppy-server to not try the S3 upload of Dropbox-pulled files in the first place?

ifedapoolarewaju commented 6 years ago

the only way to get files from Dropbox into an S3 bucket is by having uppy with uppy-server pull the files to the local file system of uppy-server, and then to upload them to S3 with my own solution?

yes this is correct.

But how, then, would I teach uppy-server to not try the S3 upload of Dropbox-pulled files in the first place?

by setting an empty endpoint when instantiating the uploader (Xhr or Tus) in uppy-client. e.g

uppy.use(XHRUpload, {
  endpoint: ''
})
goto-bus-stop commented 6 years ago

I think it should work if we pass through form fields in the multipart uploader. Uppy already sends the necessary fields for S3 uploading along in the fields field. I'll try out a patch

field field field field field field field field field field