Comments (2)
@cjpillsbury I will tag you directly, hope that is ok.
After looking at it more, the problem seems to be with nextChunkRangeStart
property. Which is not reset correctly after fallback is applied.
nextChunkRangeStart
is updated in successfulChunkUploadCb
, then error occurs and readableStreamErrorCallback
is called, nextChunkRangeStart
is not reset-ed to 0.
This leads to nextChunkRangeStart
being different in ChunkedFileIterable
instance and UpChunk
instance
ResettingnextChunkRangeStart
in readableStreamErrorCallback
seems to fix the problem.
if (options.useLargeFileWorkaround) {
const readableStreamErrorCallback = (event: CustomEvent) => {
// In this case, assume the error is a result of file reading via ReadableStream.
// Retry using ChunkedFileIterable, which reads the file into memory instead
// of a stream.
if (this.chunkedIterable.error) {
this.nextChunkRangeStart = 0; // <-- reset nextChunkRangeStart
console.warn(
`Unable to read file of size ${this.file.size} bytes via a ReadableStream. Falling back to in-memory FileReader!`
);
event.stopImmediatePropagation();
// Re-set everything up with the fallback iterable and corresponding
// iterator
this.chunkedIterable = new ChunkedFileIterable(this.file, {
...options,
defaultChunkSize: options.chunkSize,
});
this.chunkedIterator = this.chunkedIterable[Symbol.asyncIterator]();
this.getEndpoint().then(() => {
this.sendChunks();
});
this.off('error', readableStreamErrorCallback);
}
};
this.on('error', readableStreamErrorCallback);
}
from upchunk.
Hey @theazgra sorry for the delayed response! That looks right to me and all makes sense. Feel free to issue a pull request if you wanted to contribute!
from upchunk.
Related Issues (20)
- Multiple uploads HOT 4
- Error 501 - not implemented, when trying to upload to AWS S3 bucket via pre-signed URL HOT 2
- Error on deployed Next.js website HOT 9
- I am try to resume upload, but it seems it restart again but no resume. HOT 3
- The video asset get auto deleted after 24 hours? HOT 1
- parallel upload of chunks HOT 2
- Progress event arguments bug HOT 9
- Uploading large files on mobile browsers fails HOT 1
- Retrieving Asset ID after upchunk finishes an upload? HOT 2
- [Bug] Failure to Handle 'Range' Response Header in Chunked Uploads to GCS HOT 2
- [Feature Request] Response object inside the 'error' event HOT 2
- How to pass additional data with request HOT 5
- TypeError: Cannot read properties of null (reading 'includes') HOT 1
- Upload of large files 4GB+ fails on Safari. UpChunk or WebKit problem? HOT 9
- TypeError occurred using a Japanese file name HOT 9
- Failed chunk upload callback response is undefined error HOT 1
- returning the asset ID on success HOT 1
- GCS chunked request overwrites existing file instead of appending to it HOT 2
- Progress events shoot to 100% when going offline
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upchunk.