Addon.httpclient not updating global variable

Hi Team,

I am calling addon.httpclient to call rest API of JIRA, please check the below code

but here it’s not updating data value after printing on console its showing undefined.

did I am missing something here?

async function getAllProjects(req, ts)
let data;
return new Promise((resolve, reject) => {
.get(“rest/api/3/project?”, function(err, response, body)
data = JSON.parse(body);
if (err) reject(err);
return data;

Any Help on this, please.
Thanks in advance.


Any response on this please.

This should work fine as I have verified it myself. Could you please make sure that whichever route you are calling this function from, that route is secured with JWT using plugin.authenticate()? You can read more about it here -

Otherwise, the above function is perfectly fine.