I have AWS lambda function that I am trying to call from my web app using Axios. It keeps giving the error: 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I am using serverless and I have added the cors:true attribute to my function. I have also added:
const response = { statusCode:200, headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': true }, body: JSON.stringify({ message: 'Ticket received', TableData: data, }), }; callback(null, response); I still can't get this issue resolve. Any help is greatly appreciated.