i know have a similar Q/A on stackoverflow, but i need .net solution.....i'm going crazy... i have a simple lambda using .net C# return input value
public string FunctionHandler(Input input, ILambdaContext context)
{
return JsonConvert.SerializeObject(input.Name);
}
this lambda trigger by API Gateway, and also finished all step from aws online document completed! Include Enable CORS and reDeploy API!Still get error
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:7076' is therefore not allowed access. The response had HTTP status code 400.
in the similar Q/A @sqren said
If you have lambda-proxy enabled, you need to set the CORS headers manually:
module.exports.hello = function(event, context, callback) {
const response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Origin" : "*", // Required for CORS support to work
"Access-Control-Allow-Credentials" : true // Required for cookies, authorization headers with HTTPS
},
body: JSON.stringify({ "message": "Hello World!" })
};
callback(null, response);
};
Please does anyone have .net solution to help me fixed this problem....
any help is really appreciated, I hope the AWS team is watching too...even though i created AWS Developer Support QQ.....