question

Casper avatar image
Casper asked

Got response error when use sleep() function in PHP and Bash

I need to do some delay in a shell script so I use sleep() to delay the execution. However when the script successfully executed, I got response error "The remote endpoint could not be called, or the response it returned was invalid." Does anyone know why this is happening? The script works fine except no response from Echo (tried both sleep() in PHP and Bash), and if I remove the sleep(), I got no errors.
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Casper avatar image
Casper answered
I now figured out the error is because the function takes "too long" to finish according to Alexa. So I guess my function exceeds the timeout that Alexa allows. All I need to do is execute a bash script triggered by Alexa, and some delay is needed for my script. Is there anyway to set timeout for Alexa? or maybe any way I can run my bash script simultaneously with the handler function in PHP?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Levon@Amazon avatar image
Levon@Amazon answered
Hello, The Alexa timeout is 10 seconds. (i.e. your skill must return a response to Alexa within 10 seconds or be timed out). This is set by the platform and is non-configurable. I'm not sure why sleep is needed in your function without knowing the entire structure of your solution, but maybe there's a way to re-architect it, or at least to decrease the sleep value? Thanks, Levon
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.