I get this error message from the Angular frontend and I am not authorized to touch my lambda code:
`Access to fetch at \'https://testapicd.***.***.com/local
I have wrestled with this problem for hours (if not days) before and it turned out not only I had to enable cors on the serverless.yml file but also add the response headers as attributes in the object you return from your Lambda.
Something like this should do it:
const response = {
statusCode: 200,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': true,
},
body: JSON.stringify({
product: product
}),
};
This article saved my life back then and I hope it saves yours!