question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Long running response / setTimeout not being called

See original GitHub issue

What 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:open
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
dblockcommented, May 16, 2017

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.

0reactions
dblockcommented, Jul 20, 2017

Can we document (and link) this in README please? Care to PR?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found