You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My HTML form posts the file to node and node uses s3-upload-stream to push the file to S3. But the problem is that it works only for files < 1 MB . Here is the code
publicAttachToS3(req: Request,res: Response): Promise<string>{returnnewPromise<string>((resolve,reject)=>{constforForm=req.get('for');this.form.multiples=true;this.form.onPart=(part)=>{constattachment=this.s3Stream.upload({Bucket: this.bucket,Key: forForm+'-'+part.filename});// Optional configuration// attachment.maxPartSize(6000000); // 6 MBattachment.concurrentParts(5);// Handle errors.attachment.on('error',(err)=>{this.logger.error(err);reject('Attachment upload to S3 failed');});attachment.on('uploaded',(details)=>{resolve('Attachment uploaded: '+forForm+'-'+part.filename);});// Maybe you could add compress like// part.pipe(compress).pipe(upload)part.pipe(attachment);};// log any errors that occurthis.form.on('error',(err)=>{this.logger.error(err);reject('Attachment upload to S3 failed');});// parse the incoming request containing the form datathis.form.parse(req);});}
When i try to attach any file > 1 MB I get the following error being logged. The logged error does not give me any indication of what could be wrong.
[0] [2019-01-31T16:24:05.430Z] ERROR: gnw-pisces-masterdb-ui/34124 on GNWRALA2063193 (/Users/430014695/Projects/web-masterdb/gnw-pisces-masterdb-ui/server/services/attachments/attachment.service.ts:66 in attachment.on): Failed to upload a part to S3: {"message":null,"code":500,"region":null,"time":"2019-01-31T16:24:00.585Z","requestId":null,"statusCode":500,"retryable":true}
[0] [2019-01-31T16:24:05.436Z] ERROR: gnw-pisces-masterdb-ui/34124 on GNWRALA2063193 (/Users/430014695/Projects/web-masterdb/gnw-pisces-masterdb-ui/node_modules/src/core/request-error-handler.ts:78 in RequestErrorHandler.log): Application error (err="Attachment upload to S3 failed")
I know i am doing something wrong with the parts etc , any help would be appreciated
Here are some things i tried without success:
Increase the attachment.maxPartSize(6000000).
raised concurrent parts to 10
The text was updated successfully, but these errors were encountered:
My HTML form posts the file to node and node uses s3-upload-stream to push the file to S3. But the problem is that it works only for files < 1 MB . Here is the code
When i try to attach any file > 1 MB I get the following error being logged. The logged error does not give me any indication of what could be wrong.
I know i am doing something wrong with the parts etc , any help would be appreciated
Here are some things i tried without success:
The text was updated successfully, but these errors were encountered: