Multipart Upload to S3 with mongodb-stitch-browser-sdk HELP!

24 views
Skip to first unread message

Pablo Cid

unread,
Jun 24, 2019, 10:20:29 PM6/24/19
to MongoDB Stitch Users
Hi there, someone have tried to upload a big file with stitch? I use this syntaxis for upload files.

import { AwsServiceClient } from 'mongodb-stitch-browser-services-aws';
import { AwsRequest } from 'mongodb-stitch-core-services-aws'

public s3PutObject(dataURL: string, Key: string, Bucket: string) {
const ContentType = this.base64MimeType(dataURL);
const Body = {
$binary: {
base64: dataURL.split(',')[1],
subType: '00'
}
};

const aws = this.client.getServiceClient(AwsServiceClient.factory, "AWServices");
const args = { ACL: 'public-read', Bucket, ContentType, Key, Body };
const request = new AwsRequest.Builder()
.withService('s3')
.withAction('Upload')
.withRegion('us-east-1')
.withArgs(args)
.build();
return aws.execute(request);
}

And works OK for small files.  Someone has tried with this syntaxis to upload big files ???

const request = new AwsRequest.Builder()
.withService('s3')
.withAction('Upload') || .withAction('CreateMultipartUpload')
.withRegion('us-east-1')
.withArgs(args)
.build();


Doesn't work for my. Any suggestion? 




Drew DiPalma

unread,
Jun 25, 2019, 7:56:33 AM6/25/19
to MongoDB Stitch Users

Hi Pablo – 

For larger objects, you will need to use AWS' signPolicy() – let me know if you have any questions about this.  

Thanks,
Drew

Pablo Cid

unread,
Jun 25, 2019, 9:34:00 AM6/25/19
to MongoDB Stitch Users
Hi Drew, let me understand. That function gives me the credentials I need, for example, to connect in the browser with a post request or via aws browser sdk ?
Reply all
Reply to author
Forward
0 new messages