I have an AWS Lambda function that I've set up and am attempting to hit from the front end. It works fine in browser, and returns the response I expect. When I try to hit it from localhost
, I get a 403. I have tried to follow the steps outlined here and here (short of blowing away my entire API as some commenters mentioned), to no avail. I redeploy after all changes. After enabling CORS, I cease to get a 403, and instead get a 415. Unsure what to do next as there's nothing in the Cloudwatch logs.
Some more detail: I am using a Lambda:
I have a GET method ('Options' appeared after I enabled CORS):
Here's what happens when I click 'Enable CORS':
Because it's cut off in the screenshot, here is the complete list of headers: 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'
Here's how I call my lambda on the front end:
sendVerificationCode() {
let data = {
paramOne: x,
paramTwo: 'string',
paramThree: 'string'
}
return this.get('ajax').request('https://something.execute-api.us-east-1.amazonaws.com/beta/', {
host: 'https://something.execute-api.us-east-1.amazonaws.com',
method: 'GET',
data: data
}).then((response) => {
console.log('response', response)
});
}
Here are the errors I'm getting. The first error, before I enable CORS: