[AWS Client Side Services Reactive] Getting Error while uploading docx file on S3
Forge component by Tiago Dias


I am getting below error while uploading docx file in s3:

AWSClientSideServicesReactive.AWS_SDK2_684_0.js?K0CzFy8tTJe64Ex+nzug4Q:72 Refused to connect to 'https://costimize-test-bucket.s3.ap-south-1.amazonaws.com//' because it violates the following Content Security Policy directive: "connect-src 'self'"

[AWS s3 undefined 0.571s 3 retries] listObjects({ Bucket: 'costimize-test-bucket', MaxKeys: 0 })

AWSClientSideServicesReactive.AWS_SDK2_684_0.js?K0CzFy8tTJe64Ex+nzug4Q:72 [AWS s3 undefined 2.059s 3 retries] putObject({ Body: {}, Bucket: 'costimize-test-bucket', Key: '/' })

AWSClientSideServicesReactive.AWS_PutObject.js?ySxyRLRdy2IfyE+l6ue18g:46 NetworkingError: Network Failure at XMLHttpRequest.<anonymous>

I don't understand why body is empty? Even i debug the below script and it gives me error at  s3.upload()

param = Body: File {name: "Invoice Template.docx", lastModified: 1619061047837, lastModifiedDate: Thu Apr 22 2021 08:40:47 GMT+0530 (India Standard Time), webkitRelativePath: "", size: 25038, …}

Bucket: "costimize-test-bucket"

Key: "/"

__proto__: Object


// Function to upload content to AWS

var ProgressUpload=0;

var ErrorMessageValue='';

function PutObject(AccessKey, SecretAccessKey, SessionToken, KMS_TargetKey, Region, UploadWidgetId, ButtonUploadId, Bucket, Key ,ErrorButtonId, SuccessButtonId, SendProgressId, UploadWidgetTagName) {




        // Initialize AWS config

        AWS.config.region = Region; 

        AWS.config.logger = console;

        AWS.config.credentials = new AWS.Credentials({

          accessKeyId: AccessKey,

          secretAccessKey:  SecretAccessKey, 

          sessionToken:  SessionToken



       var files =document.getElementsByName(UploadWidgetTagName).item(0).children.item(0).files;


       var progressaux=1;



       document.getElementById(ButtonUploadId).disabled = true;



        // Validate Empty File

        if (files.length===0) {

          alert('Select content first!');

          document.getElementById(ButtonUploadId).disabled = false;




        var s3 = new AWS.S3({apiVersion: '2006-03-01'});

        var params = {

          Bucket: Bucket,

          Key: Key,

        //   ServerSideEncryption :'aws:kms',

        //   SSEKMSKeyId: KMS_TargetKey,

          Body: files[0]


        var managedUpload =

          s3.upload(params, function(error, data) {

            console.log(error, data);  

            if (error) {


            } else {





            document.getElementById(ButtonUploadId).disabled = false;


        managedUpload.on('httpUploadProgress', function (progress) {


        progress = parseInt((progress.loaded * 100) / progress.total);




         ProgressUpload = progress;













Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.