AWS S3 storage using LANSA API (RESOLVED)

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jonno
Posts: 5
Joined: Thu Nov 22, 2018 12:18 pm

AWS S3 storage using LANSA API (RESOLVED)

Post by jonno » Fri Oct 11, 2019 11:22 am

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).

TonySupartono
Posts: 2
Joined: Fri Oct 11, 2019 12:13 pm

Re: AWS S3 storage using LANSA API

Post by TonySupartono » Mon Oct 14, 2019 8:52 am

You’d need to enable CORS on the S3 bucket.

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

jonno
Posts: 5
Joined: Thu Nov 22, 2018 12:18 pm

Re: AWS S3 storage using LANSA API

Post by jonno » Mon Oct 14, 2019 9:35 am

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.

jonno
Posts: 5
Joined: Thu Nov 22, 2018 12:18 pm

Re: AWS S3 storage using LANSA API

Post by jonno » Mon Oct 14, 2019 10:37 am

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!

Post Reply