I'm developing a Salesforce component that makes a request to AWS S3 using the AWS JavaScript SDK.
When making the request below, I receive the console error Refused to connect to https://mybucket.s3.amazonaws.com/list-type=2&prefix=00Q5e000001Vx7iEAC
s3.listObjectsV2(
{Bucket:'mybucket', Prefix: component.get('v.recordId')},
function (err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
}
);
I am confused why this is happening since I am able to make requests using s3.getSignedUrl()
without any errors.
What do I need to do to allow this request from Salesforce to AWS?
As @jellycsc said, I realized that the requests were different.
Turns out that I just needed to add https://mybucket.s3.amazonaws.com
to my CSP trusted sites in Salesforce.