Inconsistent "The Lambda Function Returned An Error."

0

I have an AWS Lambda (node.js) that returns a value, in this case, an NPI number. Per the AWS documentation (https://docs.aws.amazon.com/connect/latest/adminguide/connect-lambda-functions.html#verify-function), I am returning a JSON flat object:

function successResponse(npi, callback) {
	const npiResponse = {
		NPI: npi
	};
		
	console.log(`Response back to client: ${JSON.stringify(npiResponse)}`);
	
	callback(null, npiResponse);
}

If I look at CloudWatch log for this response, I see:

2020-03-27T16:45:03.026Z	afe0c304-bac7-4a03-8692-81b57fb9082b	INFO	Response back to client: 
{
    "NPI": 1986799264
}

However, in the AWS Connect log, I see:

{
    "Results": "The Lambda Function Returned An Error.",
    "ContactId": "ca7db64a-7284-409d-80bf-db44ffe0ae2f",
    "ContactFlowId": "arn:aws:connect:us-east-1:611631033586:instance/ffb670d1-4977-42e6-a6f5-af43bec29887/contact-flow/73f1fc14-f26d-4067-aaed-f15982226dff",
    "ContactFlowModuleType": "InvokeExternalResource",
    "Timestamp": "2020-03-27T16:44:59.355Z",
    "ExternalResults": {
        "callCenterStatus": "Open"
    },
    "Parameters": {
        "FunctionArn": "arn:aws:lambda:us-east-1:611631033586:function:provider-npi-dev",
        "Parameters": {
            "NPI": "1986799264"
        },
        "TimeLimit": "3000"
    }
}

The response is rather simple, but I inconsistently get an Lambda error. Thoughts on what I am doing wrong?

質問済み 4年前944ビュー
1回答
0

The issue was that the Lambda entry within the contact flow has its own timeout value that supersedes the timeout value of the Lambda being called. I was suffering a timeout error when my execution time exceded the default timeout value of 3 seconds. Unfortunately, the AWS Connect log will not tell you that it was a timeout issue (or anything of significance), just that the Lamda invocation suffered an error.

回答済み 4年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ