0

I'm trying to follow the url given below.

https://aws.amazon.com/getting-started/projects/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/

I've successfully completed all the steps. But when I try to Invoke Request Unicorn. I'm getting the below error in console.

Failed to load https://jvhlk3ly43.execute-api.ap-southeast-2.amazonaws.com/prod/ride: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://wildrydes-naveen-muralidharan.s3-website-ap-southeast-2.amazonaws.com' is therefore not allowed access. ride.js:34 Error requesting ride: error , Details: ajaxError @ ride.js:34 fire @ jquery-3.1.0.js:3243 fireWith @ jquery-3.1.0.js:3373 done @ jquery-3.1.0.js:9100 (anonymous) @ jquery-3.1.0.js:9332 error (async) send @ jquery-3.1.0.js:9360 ajax @ jquery-3.1.0.js:8999 requestUnicorn @ ride.js:19 handleRequestClick @ ride.js:87 dispatch @ jquery-3.1.0.js:5110 elemData.handle @ jquery-3.1.0.js:4918 ride.js:35 Response: undefined

Could someone help me to configure the CORS.

1 Answer 1

1

CORS is usually done on the API Gateway level, you just need to configure it and deploy the stage

Check: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I've Enabled CORS and staged it. I'm getting the below error in result variable."RequestId: 6e17ed4f-bd38-11e8-8e49-ef2daf847d3b Process exited before completing request"
Then there's something wrong with the code @NaveenMuralidharan but this means that you've passed the CORS issue and now hitting the code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.