question

zimmermegan avatar image
zimmermegan asked

Posting new issues to github from Alexa Skills Kit Lambda function

I've been working on ways to get variables out of lambda for a robotic system to work on, its a pretty convuluded system but for it to work I've been trying to get the ASK JSON sample code to try to publish what the user says as issues to github. When trying to publish github issues on lambda using the following https://github.com/zimmermegan/AWSLambdaGitIssueGenerator Everything works and the logs look like this [IMG] http://i65.tinypic.com/2emn72h.png[/IMG] But as soon as I try to call the same functions with the same api in the alexa skills kit code it quits out early and doesn't get to the posting section [IMG] http://i68.tinypic.com/27wzl81.png[/IMG] I'm thinking its an issue with where context.end() is called in the base ASK code, but I'm not sure. Has anybody else had success with something similar to this?
alexa skills kitsubmission testing certification
10 |5000

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

1 Answer

Nick Gardner avatar image
Nick Gardner answered
I suspect it is exactly as you suspected, the context.succeed or context.end being called before the callback completes. The way to solve this is to make sure to nest the callbacks so that the response.askWithCard or response.tell is not called except in the callback for the post request. That way, you will never exit without completing your request. If you have the need to make sure multiple callbacks are finished, you can either fully nest them or use a library like async.js to make sure that all of the requests are completed before closing out the context. This is something I've run into a few times, and it is always a complex problem to debug and solve. Thanks, Nick
10 |5000

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