Handle CORS in Serverless APIs

Link to chapter - https://serverless-stack.com/chapters/handle-cors-in-serverless-apis.html

Hi, I received an error when trying to run the invoke command. It came out like this

Serverless: Bundling with Webpack...
{
    "statusCode": 500,
    "body": "{\"error\":\"Cannot read property 'identity' of undefined\"}",
    "headers": {
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Credentials": true
    }
}

Any suggestions

This should be easy to debug since the 500 error is coming from our code in the Lambda function. Use a console.log to print out the full error.

i got below output why I didn’t get anything in the body
{
“statusCode”: 200,
“body”: “[]”,
“headers”: {
“Access-Control-Allow-Origin”: “*”,
“Access-Control-Allow-Credentials”: true
}
}