Recommand · October 22, 2021 0

Connect detects an error in a Lambda but it is executed correctly

I have a contact flow which initiate lambda function for survey QA, the problem that I have is: when i schedule a call, Connect detects an Error on the lambda function, but when I check the Cloudwatch Logs I see that the Lambda was executed correctly, Is there a workaround for this?

Connect Cloudwatch Log:
"Results": "The Lambda Function Returned An Error.",
"ContactId": "a957c9b8-4299-4698-912d-d2e12303d174",
"ContactFlowId": "",
"ContactFlowModuleType": "InvokeExternalResource",
"Timestamp": "2021-10-04T18:41:28.060Z"

I checked return json from labda function and it is sigle layered and not multi layered json like below

{
"Key1": "Value1",
"Key2": "Value2",
"Key3": "Value3"
}

Can anyone suggest, what is going on here?

NOTE: This is random behaviour. Sometimes it works well and somethimes it gives error of "Connect detects an Error on the lambda function"