question

Sean avatar image
Sean asked ·

HTTP GET with Alexa Skills Kit Lambda

Hey Everybody,

I'm writing my first ASK and I'm having trouble calling an API via HTTP GET. I have added console.log debugging lines and it seems it never call my http.get function. I've read a couple of other threads and they talk about a callback needs to be implemented properly, so that you wait for the HTTP GET to return and not let Lambda kill it prematurely. I believe that is my issue, but I don't understand where the callback comes into play.

Thanks in advance!

alexa skills kitdebugginglambda
10 |2000 characters needed characters left characters exceeded

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

Mark Stringer avatar image
Mark Stringer answered ·

Take a look at the Tide pooler sample skill. It's not been updated for the new SDK but that does not affect how the http get callback works https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/tidePooler/src/index.js

10 |2000 characters needed characters left characters exceeded

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

Galactoise avatar image
Galactoise answered ·

I'm guessing you're using Node for your Lambda, right? If so, can you copy and paste the line that starts with:

exports.handler = 
10 |2000 characters needed characters left characters exceeded

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

Brent Hunter avatar image
Brent Hunter answered ·

My skill used Python, and so I had to include and import the "requests" Python module.

10 |2000 characters needed characters left characters exceeded

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