im creating a serverless api with nodejs and im using api gateway to invoke my lambda functions and i have my frontend build with reactjs. when i call my api through react app i get following error.
Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*,http://localhost:9988', but only one is allowed
here is my serverless.yaml
listBank:
handler: bank/list.list
events:
- http:
path: bank
method: get
cors:
origins:
- '*'
- 'http://localhost:9988'
headers:
- Content-Type
- X-Api-Key
- Access-Control-Allow-Headers
- Access-Control-Allow-Origin
- Access-Control-Allow-Methods
- Access-Control-Allow-Credentials
allowCredentials: false
private: true
here is my get function respond header
const response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Origin" : "*",
"Access-Control-Allow-Credentials" : true
},
body: JSON.stringify(result.Items),
};
what i am missing?