My Atlassian Connect addon does not connect with database

Alvaro Aranda August 20, 2015

Hi,

I'm currently developing an addon for Atlassian Connect (JIRA) and I have problems on database connection.
I have followed the documentation and I have two environments on config.json: development and production.

On the development environment I'm using sqlite storage, only for testing purposes. It works nice, and the configuration is like this:

"store": {
"adapter": "jugglingdb",
"type": "sqlite3",
"database": "store.db"
}

On the production environment I need a real database, so I have tried with Postgres and Mysql, but none of this have worked. For Postgres, this was the database configuration:

"store": {
"adapter": "jugglingdb",
"type": "postgres",
"url": "postgresql://my_server:my_port/addon_database_name?user=my_user&password=my_pass"
}

I'm using that dependencies for that:

"jugglingdb": "0.2.14",
"jugglingdb-postgres":"0.1.0"


And the lifecycle of the addon is only controlling installed event (and I'm not doing any special management here):

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


But when I'm installing the addon on my JIRA, I've got this error:

[ 2015-08-20 15:15:04.0106 17383/7fbb01dd2700 App/Poo/AnalyticsCollection.cpp:104 ]: Process (pid=12687, group=/var/www/AtlassianPlugin/public) no longer exists! Detaching it from the pool.
[ 2015-08-20 15:15:04.0107 17383/7fbb01dd2700 age/Cor/Main.cpp:794 ]: Disconnecting long-running connections for process 12687, application /var/www/AtlassianPlugin/public
App 12709 stdout:
App 12709 stdout: Add-on server running at my_server:my_port
App 12709 stderr: /var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/lib/postgres.js:419
App 12709 stderr: data.forEach(function(field){
App 12709 stderr: ^
App 12709 stderr: TypeError: Cannot read property 'forEach' of undefined
App 12709 stderr: at decoratedCallback (/var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/lib/postgres.js:419:13)
App 12709 stderr: at /var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/lib/postgres.js:64:20
App 12709 stderr: at /var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/node_modules/pg/lib/pool.js:75:25
App 12709 stderr: at /var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/node_modules/pg/node_modules/generic-pool/lib/generic-pool.js:274:11
App 12709 stderr: at /var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/node_modules/pg/lib/pool.js:27:26
App 12709 stderr: at null.<anonymous> (/var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/node_modules/pg/lib/client.js:181:5)
App 12709 stderr: at emit (events.js:107:17)
App 12709 stderr: at Socket.<anonymous> (/var/www/AtlassianPlugin/node_modules/jugglingdb-postgres/node_modules/pg/lib/connection.js:109:12)
App 12709 stderr: at Socket.emit (events.js:107:17)
App 12709 stderr: at readableAddChunk (_stream_readable.js:163:16)


If I use the Mysql database on the production environment, the config is like this:

"store": {
"adapter": "jugglingdb",
"type": "mysql",
"url": "jdbc:mysql://my_server:my_port/addon_database_name?user=my_user&password=my_pass"
}

I'm using that dependencies for that:

"jugglingdb": "0.2.14",
"jugglingdb-mysql":"0.0.10"

And it also breaks. Now, the error is:

connection.connect err { [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
fatal: true }

 

I have tested that the databases can be reach for any pc.

Can anyone tell me more about this?

Thanks.

 

 

3 answers

1 accepted

2 votes
Answer accepted
Alvaro Aranda August 24, 2015

I have resolved the problem, it was a wrong database URL. The correct database URL schema is:

postgres://my_user:my_password@my_server:my_port/my_database

LunarLincoln March 4, 2016

This was exactly my issue, thanks very much!

0 votes
Robert Massaioli _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2015

If you don't have a database yet then I can highly recommend Amazon RDS: https://aws.amazon.com/rds/

0 votes
Robert Massaioli _Atlassian_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2015

Are you actually replacing "url": "postgresql://my_server:my_port/addon_database_name?user=my_user&password=my_pass" with your own server, port, database name, username and password. Aka, do you actually have a database and where is it running?

Suggest an answer

Log in or Sign up to answer