Long running response / setTimeout not being called
See original GitHub issueWhat is the longest an Alexa skill can wait before responding… Here’s some sample code that I’ve been testing out (on both Lambda & on a express / Node version too).
const alexa = require('alexa-app')
const app = new alexa.app('my-long-running-app')
app.intent('SampleIntent', {
'utterances': ['sample']
}, (req, res) => {
return new Promise((resolve) => {
setTimeout(() => {
res.say('I waited a minute')
resolve()
}, 60000)
})
})
The setTimeout
is more just a placeholder for a long running function. The above code does work usually in the ~30 seconds range, but will go completely unresponsive around ~40+ seconds (And will only time out after a few minutes and say "there was a problem with the … ").
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
javascript - setTimeout doesn't seem to be calling the function
Because the code in the setTimeout() runs sometime LATER, your value of done will NEVER be changed and this loop will run forever....
Read more >setTimeout() - Web APIs - MDN Web Docs
The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.
Read more >Timer Mocks - Jest
When this API is called, all timers are advanced by msToRun milliseconds. All pending "macro-tasks" that have been queued via setTimeout() or ...
Read more >The Node.js Event Loop, Timers, and process.nextTick()
The event loop is what allows Node.js to perform non-blocking I/O ... As a result, long running callbacks can allow the poll phase...
Read more >setTimeOut in useEffect API call (Data Fetching).
It is bad because multiple requests are being sent to the API and there are multiple responses too. This is caused by the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s what I was getting to. The problem is not your code, it’s the Alexa platform that’s timing it out, I suspect it’s a hard-coded limitation.
As I mentioned before, bring this up on an alexa dev forum or something like that. It will be helpful for the next person and PR an update to README here somewhere in asynchronous responses once you get a definite answer from Amazon.
Can we document (and link) this in README please? Care to PR?