Skip to content
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

AWS S3 Plugin – "ID:" has no effect #1674

Closed
randallmlough opened this issue Jun 19, 2019 · 2 comments
Closed

AWS S3 Plugin – "ID:" has no effect #1674

randallmlough opened this issue Jun 19, 2019 · 2 comments
Assignees
Labels

Comments

@randallmlough
Copy link

I have a couple drag and drop instances on a page and each one use the S3 plugin. I tried giving the S3 instance a unique ID, but I always get back the default plugin name "AwsS3"

document.querySelectorAll('.js-image-uploader').forEach(elm => {

    uppy.use(DragDrop, {
        id: window.crypto.getRandomValues(new Uint32Array(1))[0], // this works fine
        target: elm,
    });
    uppy.use(AwsS3, {
        id: window.crypto.getRandomValues(new Uint32Array(1))[0], // this doesn't appear to take
        getUploadParameters(file){
        //...
        }
    })
})

Here's the error. There shouldnt be a plugin named "AwsS3" at this point, correct?

Error: Already found a plugin named 'AwsS3'. Tried to use: 'AwsS3'.
Uppy plugins must have unique 'id' options. See https://uppy.io/docs/plugins/#id. 

package.json

{
    "@uppy/aws-s3": "^1.0.2",
    "@uppy/core": "^1.0.2",
    "@uppy/drag-drop": "^1.1.0",
}

Is this a bug or am I improperly using the S3 plugin here?

@goto-bus-stop
Copy link
Contributor

Is this a bug or am I improperly using the S3 plugin here?

I'm afraid it's both 😄

The S3 plugin is not properly using the id option. Pushing a fix in a moment!
But, adding multiple Dragdrop and AwsS3 plugins probably doesn't do what you want it to. All the DragDrop instances will add files to the same Uppy instance, and once an upload starts, all S3 instances will respond and upload all files. If the user selected a total of 10 and you have 2 S3 instances, both will upload all 10 files. To have multiple different upload areas on a single page, you need to use separate instances of Uppy and add the plugins once to each instance.

@goto-bus-stop
Copy link
Contributor

Noticed a bunch of other plugins also didn't respect the id option! Thanks for the report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants