0
votes

I am trying use java script to access an AWS api gateway to call a lambda with passing through headers. Testing via postman works fine.

enter image description here But then I attempt to access via java script enter image description here

I get the following:

'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,Access-Control-Allow-Headers,Access-Control-Allow-Origin' enter image description here

I have added in acaH and acaO to the header mapping for the option in AWS api as suggested in a number of articles, saved and redeployed to no affect. enter image description here

I have enabled CORS on both the GET and OPTION methods to no avail.

I will freely admit I just barely understand the CORS concept, am I missing something very obvious?

2

2 Answers

0
votes

You are trying to access the API from a null origin.

As stated in the console error Access from origin 'null' has been blocked, a null origin value typically indicates that the request is either coming from a file on your computer (rather than from a website) or as a result of a redirect operation.

0
votes

You better check your lambda function instead. Sometimes, that cors error will be return when some errors exposed inside your function.