ARTICLE AD BOX
My multipart uploading service for my website (using Angular) failed immediately after updating s3/lib-storage from v3.7xx to vc.9xx. This service has failed before when updating to v3.8xx, so I intentionally kept using v3.7xx, but back then the error was clearly thrown so I know the problem was something about checksum. Yet this time the error return nothing but undefined, and the upload request wasn't even made, no request shown in the console's network tab. I want to know was it because of my integration, or the package itself.
Here is my code for upload service:
const s3 = new S3Client({}) const upload = new Upload({ client: s3, params: { Body: file, Bucket: bucketName, Key: file.name, ChecksumAlgorithm: 'CRC32', }, queueSize: 10, partSize: 64 * 1024 * 1024, }); const progressListener = (prog: unknown) => { callbackFn(prog); }; upload.on('httpUploadProgress', progressListener); try { return await upload.done() } catch (error) { upload.removeListener('httpUploadProgress', progressListener); console.error(error); // <-- undefined throw error; }My upload on angular side:
defer(() => from( this.s3Service.upload(file, folderName, (resp) => { // calculate progress this.ratio = ((resp as unknown as { loaded: number }).loaded * 100) / file.size; }), ), ).subscribe({ next: (_data) => { this.ratio = 100; this.status = 'OK'; this.message = 'OK'; }, error: (error) => { this.status = 'Failed'; this.message = error.message; }, complete: () => { this.uploading = false; }, });