Stitch with AWS s3 upload error

4 views
Skip to first unread message

Ismael Rumzan

unread,
Nov 21, 2020, 4:27:40 AM11/21/20
to MongoDB Stitch Users
Hi
I followed this example:

Here is my code:
  try {
const client = Stitch.getAppClient(appID);
const aws = client.getServiceClient(AwsServiceClient.factory, "AWS");
console.log(aws);
const args = {
ACL: "public-read",
Bucket: "record-drawing-db",
ContentType: type,
Key: name,
Body: file,
};
const request = new AwsRequest.Builder()
.withService("s3")
.withAction("PutObject")
.withRegion("us-east-1")
.withArgs(args)
.build();
const result = await aws.execute(request);
console.log(result);
return result;
} catch (err) {
console.log(err);
}
};

The catch block error returns the following Stitch error
errorCode: 18
errorCodeName: "ServiceNotFound"
message: "service not found: 'AWS'"
name: "StitchServiceError"

Any ideas? I created a service called s3 in mongodb AWS services

Reply all
Reply to author
Forward
0 new messages