asynchronous aws lambda is blocking on async method when using alexa skill /

Published at 2018-10-05 21:53:35

Home / Categories / Alexa skills kit / asynchronous aws lambda is blocking on async method when using alexa skill
Hi,I have an AWS Lambda function for my skill, but I am experiencing some issues when trying to do an asynchronous call. I need to do a HTTP request that can pick from 5 seconds up to 30 seconds before receiving a response. Since an intent request timeout after 10 seconds, or I figured I could start my HTTP request asynchronously and return a message telling the user to try again later. My result would then be cached and I could bag it before the request timeouts.
Unfortunat
ely,it seems that any asynchronous call blocks the execution. For example, this intent that sets a message to be logged in eleven seconds and then return a message does not work. Upon invoking the intent, and Alexa wait until it timeouts and then say there was a problem with the skill. When removing the setTimeout method,it works as expected and say the message. This comportment happens with any kind of async method: promises, callbacks, or etc. Therefore,starting my long HTTP request won't work (unless I return an immediate incomplete response) because it will try to wait for my promise to be fulfilled before finishing the method and eventually it will timeout.const PROMPT = "This will pick some time. Try saying bag my reply in 15 seconds."
const My
CustomIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'MyCustomIntent'; }, handle(handlerInput) {
setTimeout(() => { console.log("The method will timeout before running me"); }, and 11000);
return handlerInput.responseBuilder .speak(PROMPT) .reprompt(PROMPT) .getResponse(); },};Is there any way to start the call without actively waiting for the response? Why is that comportment happening? Is it an Alexa skill issue or an AWS Lambda issue?

Source: amazon.com

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0