JIRA Cloud adon lifecycle events

Hi all,

I’m building a nodes add-on (non Forge). In this context, I would need my add-on to know tenant JIRA cloud instance base URL. As suggested in this Q&A, I’d like to get this information from the “installed” event payload.

Problem: it seems the JIRA cloud instance is not firing this event after add-on installation, or I don’t manage to catch it somehow.

In my Atlassian-connect.json, I declare the installed lifecycle event like this :

"authentication": {
        "type": "jwt"
    },
    "lifecycle": {
        "installed": "/installed"
    },
    "scopes": [
        "READ", "WRITE"
    ],

In my routes definition js, I declare the corresponding route like this :

app.get('/installed', addon.authenticate(), function(req, res)
    {
        console.log("Addon installed on a new JIRA instance !!!");
        res.status(200);
    });

But, at add-on installation, this code is never triggered, hence no possibility to get some data from the req body. Any idea ?

Thanks a lot, F.

Hi @frederictardieu ,
Have you tried listening on POST requests?

Regards,

Hi @TomaszZasada ,

Thanks for swift reply. I changed my routes code to this :

// app.get('/installed', addon.authenticate(), function(req, res)
    // {
    //     console.log("Addon installed on a new JIRA instance !!!");
    //     res.status(200);
    // });

    app.post('/installed', addon.authenticate(), function(req, res)
    {
        console.log("Addon installed on a new JIRA instance !!!");
        console.log(req.body);
        res.status(200);
    });

Now I catch the event fired from the JIRA cloud instance, but my add-on does not post an installed event as before, and the installation process fails in JIRA cloud. Before this change, it seems that ACE automatically made a POST to JIRA cloud after installation is done on add-on side.

Error message in JIRA cloud is:

The app host did not respond when we tried to contact it at “https://xxx.eu.ngrok.io/installed” during installation (the attempt timed out). Please try again later or contact the app vendor.

So it looks like my change is not enough to close the entire installation lifecycle…

Hi @frederictardieu
ACE will automatically handle the install route.
If you want to do something on install, you can use the lifecycle event like this:

// configure addon event listeners
addon.on('host_settings_saved', async (clientKey, data) => {
console.log(data);
});

Hi @marc ,

Does this require something to be declared in the add-on descriptor ?

Thanks, F.

No, you define the event listeners in e.g. app.js. The descriptor needs no changes.