5

I am trying to run a lambda function using request library. I tried to look at some other same issues, but couldnt find exactly the one i needed. Following is my code:

var req = require('request');

var headers = { 'X-AUTH-TOKEN': 'xxxx',
                'Content-Type': 'application/json',
                'Accept': 'application/json'};

var body = {"name" : "omkarEmailTest", "command_type":"SparkCommand", "language":"notebook", "note_id":"56563", "label":"YetAnotherSparkCluster"};

// Configure the request
var options = {
    url: 'http://api.quobole.com/api/v1.2/commands',
    method: 'POST',
    headers: headers,
    body: body,
    json: true
};

exports.handler = (event, context, callback) => {
 req(options, function (error, response, body) {
    console.log(body);
    callback(error);
 });
}

Following is the log i am getting in my aws lambda console:

Response:
{
  "errorMessage": "getaddrinfo ENOTFOUND api.quobole.com api.quobole.com:80",
  "errorType": "Error",
  "stackTrace": [
    "errnoException (dns.js:28:10)",
    "GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)"
  ]
}

Request ID:
"2295eee5-ec11-11e7-a9f4-dfa2f9f62b50"

Function Logs:
START RequestId: 2295eee5-ec11-11e7-a9f4-dfa2f9f62b50 Version: $LATEST
2017-12-28T20:53:20.715Z    2295eee5-ec11-11e7-a9f4-dfa2f9f62b50    undefined
2017-12-28T20:53:20.775Z    2295eee5-ec11-11e7-a9f4-dfa2f9f62b50    {"errorMessage":"getaddrinfo ENOTFOUND api.quobole.com api.quobole.com:80","errorType":"Error","stackTrace":["errnoException (dns.js:28:10)","GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)"]}
END RequestId: 2295eee5-ec11-11e7-a9f4-dfa2f9f62b50
REPORT RequestId: 2295eee5-ec11-11e7-a9f4-dfa2f9f62b50  Duration: 655.79 ms Billed Duration: 700 ms     Memory Size: 128 MB Max Memory Used: 33 MB  

Any help will be appreciated!!!!

Omkar
  • 2,274
  • 6
  • 21
  • 34

0 Answers0