Link to home
Start Free TrialLog in
Avatar of Mat Smith
Mat Smith

asked on

calling Jira create API from node js from AWS

Hi,

I've just built functionality in my Node.js app that allows me to create Jira issues via Jira API. I'm using simple login with e-mail address and token + 'request' library to make requests. It works great when I launch it from in my local environment but I keep on getting 401 - Unathorized when I deploy the app to AWS EC2. What could be the reason for this issue? Below is the example request that works when fired locally:

const headers = {
  'Authorization': 'Basic ' + Buffer.from(jiraUser + ':' + jiraPassword).toString('base64'),
  'X-Atlassian-Token': 'no-check',
  'Content-Type': 'application/json',
};

Open in new window


[code]router.get('/jira/priority', AuthGuard.verify, (req, res, next) => {
  request.get({url: jiraUrl + 'priority', headers: headers}, (err, resp) => {
    // logic
  });
});

Open in new window

[/code]

The only thing that was coming to my mind is the request origin, that might be different when firing requests from AWS.
Avatar of Shalom Carmel
Shalom Carmel
Flag of Israel image

Log your headers and see if there is any difference.
Jira should have no problem with AWS, unless your Jira manages IP whitelists.
Avatar of Mat Smith
Mat Smith

ASKER

Hi Shalom,

Thanks for your message what do you mean by logging headers?

In the cloud-based Jira the whitelist feature is no longer available
Is there someplace in the Jira api where you have to authorize a domain or ip?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.