Forums

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

Atlassian Connect Express - unable to store tenant info in mysql table

Gobinath
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!
February 14, 2018
Hi guys,

Does anyone managed to use mysql as store for ACE and each time new add-on is registered with cloud instance, does the secretkey is being updated in AddinSettings table?However it does work if i manually create mysql table and add the response from POST that sent to my app via callback=/installed.

1 answer

1 vote
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 21, 2018

Gobinath,

Can you verify with us what product you're developing for? I'd like to make sure to tag this properly so it can be seen

Regards,

Shannon

Sarthak Srivastava May 3, 2018

I am also facing same issue. I am developing the JIRA Cloud Instance add-on using Atlassian-Connect Express. please resolve this issues. Cannot able to find much info on this

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2018

Sarthak,

Have you reported this issue at Ecosystem or our Developer Community yet? These are the resources you would use to report an issue or a problem you're having developing an add-on.

Let me know if you have any trouble!

Shannon

Gobinath
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!
May 3, 2018

Hi @Shannon S,

Apologize, I have overlooked your reply.

 

Hi @Sarthak Srivastava,

I managed to solve it by installing following NodeJS packages:

 

// add the following route handler in routes/index.js

app.post('/installed'function(reqres) {

console.log('Installed [Callback] :'req.body); //Update AddonSettings Table

addon.settings.set('clientInfo'req.bodyreq.body.clientKey); //this the part manually added as part of workaround to register app

infoLog.info('[Installed Callback] Successfuly Installed in JIRA [Request Body:' + JSON.stringify(req.body+ ']');

res.status(200).send();

});

Also, in path "/node_modules/atlassian-connect-express/lib/store/jugglingdb.js", you can customize the table to store the addOnSettings which store the key to decrypt the JWT token. Importantly, the table need to have fields like "id,clientKey,key,val".

e.g 

function JugglingDB(loggeropts) { opts = opts || {}; var self = this; self._data = {}; self.promise = new RSVP.Promise(function(resolve,reject) { var type = opts.type || 'memory'; var schema = self.schema = new Schema(typeopts); schema.extend('AddonSettings', { clientKey: { type: Stringindex: true }, key: { type: Stringindex: true }, val: Schema.JSON }, { table:'JIRA_AddOnSettings'}).then( function (AddonSettings) { return new RSVP.Promise(function(resolve) { AddonSettings.schema.autoupdate(function() { resolve(AddonSettings); }); }); }) .then(function(AddonSettings) { self._AddonSettings = AddonSettings; logger.info('Initialized ' + type + ' storage adapter'); resolve(); }, function (err) { logger.error('Failed to initialize ' + type + ' storage adapter: ' + errmsg(err)); reject(err); } ); }); _.bindAll(self'get''set''del');}

 

And,configuration for "store" object in "config.json" should be something like this:

"store": { "adapter""jugglingdb", "type""mysql", "host""127.0.0.1", "username""root", "password""", "database""jira_plugin" },

 

With all these changes, I managed to get it work!

Like Satish Kumar likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events