question

indieshack avatar image
indieshack asked

Alexa and Lambda

OK, I know this is gonna get deleted/blocked fairly quickly, but I'm currently working on a POC for a fortune 500 Alexa skill. I quickly got a basic functioning skill but Lambda seems to not have a functioning discussion forum in the AWS forums (gives multiple redirects, won't log in). Does anyone know if it's possible to successfully perform a http request out of a lambda function - this seems broken for me and it's currently the top question on the AWS lambda forum. Thanks
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.

James Chivers avatar image
James Chivers answered
Hi indieshack, Yes, it is definitely possible to make an external HTTP call from AWS Lambda, what you need is: https://nodejs.org/api/http.html#http_http_get_options_callback Also, please see this discussion: https://forums.developer.amazon.com/forums/thread.jspa?messageID=17256 Hope this helps! Cheers, James
10 |5000

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

Matt Kruse avatar image
Matt Kruse answered
You can definitely make http calls from within a Lambda function, I have it up and running just fine!
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
As others have said, it is entirely possible to have HTTP callbacks from your Lambda function. However, you need to be careful of how it is programmed, as an incorrect callback structure could result in Lambda killing your function before the callback can return valid data. 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.

indieshack avatar image
indieshack answered
Many thanks for the feedback. Yes, I got strangled by the usual callback suspect - my first time playing around with Node and this is a beginners problem. I'll keep plugging at it.
10 |5000

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

Mark E. Fogle avatar image
Mark E. Fogle answered
I struggled with this a bit as well, but eventually got it working correctly. You might be able to get some ideas from the Lambda I shared at https://github.com/mefogle/AtoIFTTT.
10 |5000

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