Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Atlassian Connect "host_settings_saved" event not firing

Joseph McFadden April 29, 2019

I can successfully register and install my app on my Jira Instance and I have code in my app.ts to fire on the "host_settings_saved" event but that code is never run. I understand from these posts that this event is supposed to get fired when the addon is installed on an instance.

https://community.atlassian.com/t5/Answers-Developer-Questions/Custome-Code-for-installed-atlassian-connect-express/qaq-p/495353

https://community.atlassian.com/t5/Answers-Developer-Questions/ACE-store-data-during-installed-lifecycle/qaq-p/489785

Am I doing something wrong with the way I am checking/executing on the "/installed" path. 

atlassian-connect.json

{ "key": "xxxxxx",
"name": "xxxxx Plugin",
"description": "Description",
"baseUrl": "{{localBaseUrl}}",
"enableLicensing": false,
"links": { "self": "{{localBaseUrl}}atlassian-connect.json",
"homepage": "{{localBaseUrl}}atlassian-connect.json" },
"authentication": { "type": "jwt" },
"lifecycle": { "installed": "installed" },
...}

 

app.ts:

let listeners = require('./utils/AddonEventListener');
listeners(app, addon);

...


app
.post('/installed', function (req, res) {
res.sendStatus(200);
});

AddonEventListener:

export = (app, addon) => { 
/** * fired when addon is installed on a new instance */
addon.on('host_settings_saved', async (clientKey, data) => {
//do something
}

 Logs:

Local tunnel established at https://413a7750.ngrok.io/
Check http://127.0.0.1:4040 for tunnel status
Registering add-on...
GET /atlassian-connect.json 200 10.781 ms - -
POST /installed 200 4923.620 ms - 2

On a side note, I found that if I use:

addon.on('addon_registered', async (clientKey, data) => {

}

 

It does trigger but doesn't contain any clientKey or data.

1 answer

0 votes
Aaron Magid
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 26, 2019

I was having the same issue today. It looks like when you set up your own route handler in express for the 'installed' lifecycle hook, it disables the default Atlassian Connect behavior.

Removing the express route handler for '/installed' from my app, but leaving the

{ "lifecycle": { "installed": "/installed" } }

in my addon descriptor made the events fire.

Suggest an answer

Log in or Sign up to answer