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

Uppy / Tus - Tus options not working when passing into Uppy #1327

Closed
rockyhuber opened this issue Mar 5, 2019 · 8 comments · Fixed by #1755
Closed

Uppy / Tus - Tus options not working when passing into Uppy #1327

rockyhuber opened this issue Mar 5, 2019 · 8 comments · Fixed by #1755
Assignees
Labels
Tus Resumable file uploading vis tus.io and Uppy Tus plugin

Comments

@rockyhuber
Copy link

rockyhuber commented Mar 5, 2019

When I pass Tus options into Uppy, they're not working. I am initialising Tus in react like this:

    this.uppy.use(Tus, {
        endpoint: 'http://localhost:9000/uploads/',
        autoRetry: true,
        retryDelays: [0, 1000, 3000, 5000],
        limit: 1,
        withCredentials: true,
        removeFingerprintOnSuccess: true, // not working
        resume: true,
        onSuccess: () => {
            console.log('we finished all the uploads, Tus works'); // not working
        }
    });

I am not sure what I am doing wrong, however when uploading a previously uploaded file, it will not create a new upload. Any suggestions as to why this is not working and how I can pass these options in?

Btw I am initialising Uppy / Tus like this #1329 (comment)

@arturi arturi added the Tus Resumable file uploading vis tus.io and Uppy Tus plugin label Mar 6, 2019
@rockyhuber
Copy link
Author

I tried this using react context instead of initialising the way I did before. The same problem occurred. The Tus options still did not initialise properly.

@goto-bus-stop
Copy link
Contributor

I think there are two possible causes here. One is a small issue with the removeFingerprintOnSuccess option, reproduced by:

  • I uploaded files with removeFingerprintOnSuccess: false,
  • tus-js-client stored the fingerprint,
  • I changed to removeFingerprintOnSuccess: true, and selected the same files again,
  • tus-js-client read the fingerprint that was still stored from the earlier upload

That is something that could use a tweak in tus-js-client.

The other possible cause is that we also implement something similar to tus-js-client's resume option in Uppy Tus internally, to enable resuming uploads after network failures and the like, without the localStorage shenanigans. This may mean that selecting the same files again in the same Uppy instance (so without refreshing the page or anything), could cause the re-selected files to not be reuploaded.

Could either of those be the situation you ran into as well, or is there something more going on?

@rockyhuber
Copy link
Author

Hi, thank you for your reply. I don't think either of those situations are relevant. The first, I haven't changed the removeFingerprintOnSuccess to from false to true in 10 days. It remains false through 300+ react page refreshes.

As for the second issue, I just checked, I uploaded an audio. Completed the upload and then refreshed the page. Waited a bit and tried to upload the same audio file. A new file was not uploaded.

@rockyhuber
Copy link
Author

Maybe I am not understanding removeFingerprintOnSuccess. Help me clarify this for a second.

After I upload a file using Uppy, Uppy generates a unique fileId e.g. uppy-audiomp3-audio/mp3-203517-1548328168000. I then use this as the key for a list of files that I am/have uploaded and loop through these elsewhere in my app. As I upload the same file again, Uppy creates the exact same key uppy-audiomp3-audio/mp3-203517-1548328168000, however a new file actually appears on the server, not the same initial one. Perhaps this is the intended behaviour. I thought that Uppy would give me another uniqueId on the client side before uploading the file to the server? This obviously creates a typical unique key error. Is this how Uppy should work with the id?

@rockyhuber
Copy link
Author

rockyhuber commented Mar 12, 2019

That being said, the Tus onSuccess callback does not fire still.

onSuccess: () => {
      console.log('We finished all the uploads, Tus works');
}

@rockyhuber
Copy link
Author

@goto-bus-stop any suggestions?

@goto-bus-stop
Copy link
Contributor

sorry for leaving this hanging 😞

We should fix this in the tus documentation. The Tus plugin doesn't actually have on* options, because Uppy has separate events for those things instead. Those events work the same way regardless of the upload plugin used. In the case of onSuccess, you should instead use uppy.on('upload-success').

@abhilashak
Copy link

abhilashak commented Sep 23, 2019

Add the options as follows:

uppy.use(Tus, { endpoint: 'http://my-endpoint/files', resume: true, removeFingerprintOnSuccess: true, autoRetry: true, retryDelays: [0, 1000, 3000, 5000], limit: 3 });

remove all the files from data folder that tus server is already created with your old configuration and try again. It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tus Resumable file uploading vis tus.io and Uppy Tus plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants