Page 1 of 1

AWS S3 storage using LANSA API (RESOLVED)

Posted: Fri Oct 11, 2019 11:22 am
by jonno
Hi,

We have configured AWS S3 as per LANSA API docco and can put objects and get objects manually via Powershell.

However we are getting the following error from the xdemo image widget implementation code when running the LANSA Amazon S3 example employee image upload :

request_1.addEventListener("error", function () { return _this.fireOnUploadEnded("ERROR_NETWORK", "A network/CORS error has occurred"); });

Any suggestions?

Web console error talks about missing CORS header values
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://lansapc.s3-ap-southeast-2.amazo ... 6f1bd69721. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Re: AWS S3 storage using LANSA API

Posted: Mon Oct 14, 2019 8:52 am
by TonySupartono
You’d need to enable CORS on the S3 bucket.

Have a look at this:
https://docs.aws.amazon.com/AmazonS3/la ... nable-cors

Re: AWS S3 storage using LANSA API

Posted: Mon Oct 14, 2019 9:35 am
by jonno
Thanks Tony, I had worked that out. However we don't have access to the AWS console due to our crazy security policies so I need to perform the CORS update via Powershell which I am struggling with. I have made attempts using various syntax but not managed to get it working yet. I don't really understand the AWS s3 example on how to upload a JSON syntax file version of the CORS config.

Re: AWS S3 storage using LANSA API

Posted: Mon Oct 14, 2019 10:37 am
by jonno
eventually got our Cloud guys to do the CORS config via the console, the example photo upload worked straightaway. Waste of everyone's time (including mine) sorry. We have painful RED tape here!