Jira Cloud tutorial - npm start throws "TypeError "url" must be of type string"

javascript
documentation
npm
jira-cloud

#1

I’ve been following: https://developer.atlassian.com/cloud/jira/platform/build-a-jira-app-using-a-framework/ to get a jump of point to start development of my own Jira Cloud app but I’ve run into a error that I haven’t been able to fix:

> my-addon@0.0.1 start /Users/user/apps/cloud/test
> node app.js

url.js:150
    throw new ERR_INVALID_ARG_TYPE('url', 'string', url);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
    at Url.parse (url.js:150:11)
    at Object.urlParse [as parse] (url.js:144:13)
    at new Sequelize (/Users/user/apps/cloud/test/node_modules/sequelize/lib/sequelize.js:115:28)
    at new SequelizeAdapter (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/store/sequelize.js:49:31)
    at module.exports (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/store/sequelize.js:182:10)
    at Function.stores.create (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/store/index.js:18:10)
    at stores (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/store/index.js:12:17)
    at new Addon (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/index.js:35:38)
    at module.exports (/Users/user/apps/cloud/test/node_modules/atlassian-connect-express/lib/index.js:210:12)
    at Object.<anonymous> (/Users/user/apps/cloud/test/app.js:34:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-addon@0.0.1 start: `node app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-addon@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2018-08-30T14_05_13_876Z-debug.log

Can anybody point me in the right direction?


#2

Having the same problem.
Followed multiple Atlassian tutorials and all with the same error

Can any one point for solution?


#3

Hi Jeffrey Peeters,

It looks like you are missing a property on the config.json inside the store adapter object. Assuming you are using PostgreSQL, add a new property called url pointing to the database.

Something like the sample:

"store": {
            "adapter": "sequelize",
            "dialect": "postgres",
            "url": "postgres://localhost/my_addon_database"
},

Probably the last version of the adapter sequelize isn’t ready to receive such an input without url or the atlas-connect sample has an error on the config.json :grinning:

Kind regards,
Paulo Alves.


#4

I was having this same issue as well. I took @paulo.alves advice and added a URL parameter to the config.json (development section) and it got me past that error…on to the next one :slight_smile:

"store": {
            "adapter": "sequelize",
            "dialect": "mssql",
            "url": "mssql://localhost/database_name"
        }

These sequelize docs helped out: http://docs.sequelizejs.com/manual/tutorial/migrations.html#configuration-connection-string


#5

Good! Were you able to run the app after that change?

Paulo Alves.


#6

Yep - I received one more error after the url change complaining about not having the tedious package installed. Once I installed that I was able to run the default app that atlas-connect new provides


#7

I’m getting this error with the sqlite3 dialect and the database property… seems obvious it would complain since there’s no url here… but how do I fix this without changing the database type?
PS: this was done following the scaffold code… why have code that doesn’t work in there? :roll_eyes:


#8

Hi Ioana - Im getting the same issue. Did you ever get it resolved?