"Error: getaddrinfo ENOTFOUND" error when making an HTTPs request
Remove the https://
from the host. The require already says you're using https/SSL.
I modified your code to work correctly in AWS Lambda Node.js 6.10. I set the Lambda timeout to be 60 seconds for testing.
The big change is adding "res.on('data', function(chunk) {}:" and "res.on('end', function() {}".
var https = require('https');
exports.handler = (event, context, callback) => {
var params = {
host: "bittrex.com",
path: "/api/v1.1/public/getmarketsummaries"
};
var req = https.request(params, function(res) {
let data = '';
console.log('STATUS: ' + res.statusCode);
res.setEncoding('utf8');
res.on('data', function(chunk) {
data += chunk;
});
res.on('end', function() {
console.log("DONE");
console.log(JSON.parse(data));
});
});
req.end();
};