1
votes

I am using an AWS lambda function to serve my NodeJS codebase for an Alexa Skill.

The skill makes external API calls to a custom API as well as the Amazon GameOn API, it also uses URL's which serve audio files and images from an S3 Bucket.

The issue I am having is intermittent, and is affecting about 20% of users. At random points of the skill, the user request will produce an invalid response from the skill, with the following error:

{
"Request": {
    "type": "System.ExceptionEncountered",
    "requestId": "amzn1.echo-api.request.ab35c3f1-b8e6-4478-945c-16f644359556",
    "timestamp": "2020-05-16T19:54:24Z",
    "locale": "en-US",
    "error": {
        "type": "INVALID_RESPONSE",
        "message": "Read timed out for requestId amzn1.echo-api.request.323b1fbb-b4e8-4cdf-8f31-30c9b67e4a5d"
    },
    "cause": {
        "requestId": "amzn1.echo-api.request.323b1fbb-b4e8-4cdf-8f31-30c9b67e4a5d"
    }
},

I have looked up this issue, I believe it's something wrong with the lambda function configuration but can't figure out where!

I've tried increasing the Memory the function uses (now 256MB).

It should be noted that the function timeout is 8000ms, since this is the max time you are allowed for an Alexa response.

What causes this Read timeout issue, and what measures can I take to debug and resolve it?

2

2 Answers

1
votes

Take a look at AWS XRay. By using this with your Lambda you should be able to identify the source of these timeouts.

This link should help you understand how to apply it.

1
votes

We found that this was occurring when the skill was trying to access a resource which was stored on our Azure website.

The CPU and Memory allocation for the azure site was too low, and it would fail when facing a large amount of requests.

To fix, we improved the plan the app service was running on.