How long can I have my AWS lamba function hold before returning for alexa(amazon echo)?
Asked Answered
D

2

7

This is only for a demo and Alexa (Amazon echo) doesn't support us pushing text to it to be spoken randomly so we want to pull off a hack.

  1. User speaks into Alexa
  2. We have our lambda execute an action and then hopefully sleep and wait on an API response which will not happen until we do something
  3. Then we may post a response from another user
  4. Lambda now returns the text

In this way, we are trying to simulate two way communication through Alexa.

Do I have to worry about Alexa timing out? If so, how long will it take? Will my Lambda timeout as well (I am assuming I can just sleep in that code or hang on a remote call)?

Dislike answered 2/4, 2016 at 2:31 Comment(1)
Lambda has a max execution of 59 seconds, but I believe it can be increase to 5 minutes upon request. I don't really understand your use scenario though yet.Lynx
P
7

The response timeout is set by your AWS Lambda backend. If you do not configure it from the default, the timeout is 3 seconds by default. The rules for configuring the timeout are documented in the Lambda FAQs:

Q: How long can an AWS Lambda function execute?

All calls made to AWS Lambda must complete execution within 300 seconds. The default timeout is 3 seconds, but you can set the timeout to any value between 1 and 300 seconds.

If your response processing takes long enough to create a noticeable wait, the Echo device will flash its light ring in a rapid circle to indicate work taking place. This will continue, blocking any other interaction with the Echo device, until the response is returned or the backing Lambda function reaches its timeout limit.

Plagiarize answered 16/5, 2016 at 23:23 Comment(1)
One think to keep in mind is Alexa (device) timeout is 10 seconds and is non-configurable. So even if time out of lambda is 60 seconds you shouldn't wait that long to respond back. forums.developer.amazon.com/questions/9176/…Librarianship
J
2

I'm not sure what the maximum timeout is for Alexa, but I just tried a 60 second execution and it seemed to work. Lambda lets you set the timeout of the request under Configuration/AdvancedSettings. There is a box for minutes but have never tried upping the timeout greater then 10s of seconds.

Lambda console image

Jasonjasper answered 28/4, 2016 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.