sk2412
sk2412

Reputation: 31

AWS Lambda not firing nodejs request module

I am trying to execute Lambda function that has the request module. Unfortunately, it is not firing the request module. Neither does it give any error in the cloudwatch logs.

Request your help, what could be the issue for which this request module is not fired. This works using Postman.

Nodejs Version Used: 8.10

request({
      url: 'https://api.amazon.com/user/profile',
      headers: {
        'Authorization': 'Bearer '+ bearerTok,
          'Content-Type': 'application/json'
        },
      rejectUnauthorized: false
    }, function(err, res) {
          if(err) {
            console.error("Error"+err);
          } else {
            console.log("Result+"+res.body);
            callback( res.body);
          }

    });

Upvotes: 0

Views: 299

Answers (1)

md-shah
md-shah

Reputation: 405

You need to specify what type of METHOD it is. method : "TYPE"

{
  method : "GET",
  url: 'https://api.amazon.com/user/profile',
  headers: {
    'Authorization': 'Bearer '+ bearerTok,
      'Content-Type': 'application/json'
    },
  rejectUnauthorized: false
}

Upvotes: 1

Related Questions