acantril / learn-cantrill-io-labs

Standard and Advanced Demos for learn.cantrill.io courses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pet-Cuddle-O-Tron | CORS issue between S3 and API gateway

raunak111 opened this issue · comments

CORS is enabled on the API created. Verified using the curl command below:

image

After submitting values from the S3 static website, I get this error:

Access to fetch at 'https://hfg9swflk0.execute-api.us-east-1.amazonaws.com/prod/petcuddleotron' from origin 'http://petcuddleotron9007.s3-website-us-east-1.amazonaws.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

image

The error is typeerror, which is not a CORS error.
I suspect you have misclicked one of the boxes while setting up API Gateway or not edited the api_handler function correctly.
If you paste the logs for this lambda function we can diagnose.

Ok so it looks like you have deleted it ... I'm going to go ahead and close this issue.
No diagnosis can be done without the infrastructure in place.

I checked the logs of the lambda function, and it was blank.
The first step of sending the data from our website to the api is not happening.
So the api never called the lambda function in the proceeding step

Ok so it looks like you have deleted it ... I'm going to go ahead and close this issue. No diagnosis can be done without the infrastructure in place.

I'm sorry adrian, didn't realize you were debugging it from your end.
I proceeded in the course and followed stage6 which was cleanup

I recreated my issue, and created admin credentials for you and sent it on adrian@cantrill.io

S3 website: http://petcuddleotron9007.s3-website-us-east-1.amazonaws.com/
API URL: https://x225ufa561.execute-api.us-east-1.amazonaws.com/prod
Lambda code:
image

Debugging just the beginning of website+api+lambda would be sufficient for me, so didn't create the whole infrastructure