Thursday, 18 May 2017

AWS Lambda HTTP/API request using Node.JS

I'm new to skill dev and am trying to make an API call from within an intent (for the sake of this example, I am just using Google). For whatever reason, the log statements never execute in my HTTP request:

var test = http.get('http://www.google.com', function (result) {
  console.log('Success, with: ' + result.statusCode);
}).on('error', function (err) {
  console.log('Error, with: ' + err.message);
});

console.log('test is', test);

The test log statement after the request returns a ClientRequest object.

I thought it must be related to it being an async function, but I haven't had any luck.

Is it possibly a setting in AWS Lambda that I need to configure?



via Molly Harper

No comments:

Post a Comment