0

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);
          }

    });
2
  • Try generating code snippets using postman itself. Try this for more info Commented Dec 19, 2018 at 11:58
  • 2
    Is this all that is inside your Lambda file? Where is the handler? Commented Dec 19, 2018 at 12:03

1 Answer 1

1

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
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.