Google Cloud Storage issues
See original GitHub issueHi, I’m trying to use tus-node-server & tus-js-client for resumable uploads to Google Gloud Storage,
First up, some context: as I understand it, the chunkSize
must be set to lower than the file size in order for it to actually be “resumable”, otherwise it just starts over at the beginning after any pause/interruption. So the default size of Infinity
on tus-js-client seems like a poor choice given that resumability is the headline feature. But, as far as I can tell, it’s the only setting that actually works, at least for Google Cloud Storage. Anything less than the size of the uploaded file hits multiple issues:
-
409 Upload-Offset conflict. GCS appears to take some time to process uploaded data and update the file size. So, when the second chunk begins, GCS still reports a file size of 0, and then tus-node-server rejects the second chunk because it’s starting offset doesn’t match the erroneous file size that GCS reports.
I’m not sure what a good way to solve this is. Disabling the offset check works, but then you’re not following the protocol. Adding a 15-second delay also works, but is slow and stupid and brittle.
-
With a hack in place to get around the above, the third chunk starts in the wrong position. This is because, I think, the
0
should beoffset
here: https://github.com/tus/tus-node-server/blob/master/lib/stores/GCSDataStore.js#L151This seems like a straightforward logic error, but the only thing that gives me pause is that it also starts at 0 in https://github.com/tus/tus-node-server/blob/master/lib/stores/FileStore.js#L111 and that one seems to works correctly. So maybe I’m misunderstanding something.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
This should be fixed by now 😃
FWIW, I figured out where Google’s official library for this is: it’s part of the Firebase SDK: https://firebase.google.com/docs/storage/web/start
I switched to that and things started working properly.