When should I have to delete and reinstall the app?

Hey Team

Excited to be working on my first JIRA plugin. We’re making something for our service to enhance the issues view.

Right now, I’ve just finished the tutorial here:
https://developer.atlassian.com/cloud/jira/platform/project-activity/

However, I had a difficult time following it.

During development, on the Activity page, I often saw “Could not find stored client data” as an error message. I then had to head to Manange apps, remove the app and then reinstall by pasting the link to my atlasssian-connect.json.

I’m running the tutorial locally with npm start, and using ngrok as suggested.

The tutorial says a refresh after starting and stopping the server is sufficient for changes to appear - but I’m finding this hard to agree with from my experience.

So my questions are:

  • When should I have to delete and reinstall the app?
  • When should I just be able to re-run npm start?

Thanks,
Sam

Hey Sam,

Did you fill out the credentials.json file? That file is used to provide a better developer experience when developing your app. When you run npm start it will check that for instance and username / password and will automatically install and reinstall on app changes.

You will need to stop and rerun npm start on any changes to atlassian-connect.json.

Please let me know if that works for you.

Thanks,
Ralph

Out of curiosity - did you modify the config.json? If you didn’t then the installation payload is getting wiped each time that you stop the node app because it’s using a memory store instead of something that can persist in between the runs. Let me know if you need more details.

Hey Ralph,

Thanks for the reply. I did indeed, as per the tutorial, so I dont think that is the cause and I will keep looking.

Thanks,
Sam

Hey Daniel,

I did not. Under storage I have this uncommented (default from generator I think)

       "store": {
            "adapter": "sequelize",
            "dialect": "sqlite3",
            "type": "memory"
        }

The total file looks like:

// It's OK to write comments in this JSON configuration file,
// comments will be stripped when this file is loaded.
{
    // "development" is the default environment.
    // To change, set NODE_ENV (http://expressjs.com/api.html#app.configure).
    "development": {
        // Port the Express server will listen on.
        "port": 3000,
        // Use views/unauthorized.hbs for error page.
        "errorTemplate": true,
        // atlassian-connect-express currently integrates with Sequelize for
        // persistence to store the host client information (i.e. client key,
        // host public key etc.). When no adapter is specified, it defaults to
        // memory.
        //
        // To specify a storage other than memory, set
        // "dialect" to one of Sequelize's other supported dialects:
        // http://docs.sequelizejs.com/manual/installation/usage.html#dialects
        //
        // To use a custom storage adapter, configure it in "store".
        // Make sure to register the adapter factory in app.js:
        //
        //   ace.store.register(adapterName, factoryFunction)
        //
        // At https://bitbucket.org/atlassian/atlassian-connect-express/src/master/lib/store/,
        // see index.js and sequelize.js for code demonstrating how to write
        // a conformant adapter. The default values are as follows:
        //
        // "store": {
        // "adapter": "sequelize",
        // "dialect": "sqlite3",
        // "storage": ":memory:"
        // },
        //
        // To configure PostgreSQL, the following can be used:
        //
        //   "store": {
        //     "adapter": "sequelize",
        //     "dialect": "postgres",
        //     "url": "postgres://localhost/my_app_database"
        //   },
        //
        // An appropriate DB driver for Sequelize is required for storage other than memory.
        // For PostgreSQL, run the following command:
        //
        //   npm install --save pg
        "store": {
            "adapter": "sequelize",
            "dialect": "sqlite3",
            "type": "memory"
        }
    },
    // Configuration for production, which is enabled by setting
    // the NODE_ENV=production environment variable.
    "production": {
        // PaaS like Heroku will provide HTTP port via environement variable.
        "port": "$PORT",
        // Use views/unauthorized.hbs for error page.
        "errorTemplate": true,
        // Public URL to production app.
        "localBaseUrl": "https://XXXXXXXXX.ngrok.io", // (Redacted)
        "store": {
            // Don't use memory storage for production, otherwise
            // data in the storage will go away when the app server restarts.
            // Here, we use PostgreSQL:
            "type": "postgres",
            // PaaS like Heroku will provide DB connection URL through environment variable.
            "url": "$DATABASE_URL"
        },
        // The app can only be registered by the products on these domains:
        "whitelist": [
            "*.jira-dev.com",
            "*.atlassian.net",
            "*.atlassian.com",
            "*.jira.com"
        ]
    },
    "product": "jira"
}

Any further ideas would be appreciated!

Thanks,
Sam

Change the development part to be:

"development": {
        // This is the port your Express server will listen on
        "port": 3000,
        //Use 'unauthorized.hbs' template for displaying an error page
        "errorTemplate": true,
        // atlassian-connect-express currently integrates with Sequelize for
        // persistence to store the host client information (i.e., client key,
        // host public key, etc). When no adapter is specified, it defaults to
        // Sequelize's fallback memory storage.
        //
       
        "store": {
            "adapter": "sequelize",
            "dialect": "sqlite",
            "storage": "./developemnt.sqlite",
            "logging":false

        }
    },

Then the installation data will be stored locally

1 Like

Hey Sam,

Something I noted in this tutorial was that in the credentials.json instructions, it suggested using

	"hosts": {
		"your-instance.atlassian.net": {
			"product": "jira",
			"username": "your-email@address.com",
			"password": "your-api-token"
		}
	}
}

But I noticed there seems to be a bug at the moment and i actually had to use "https://my-instance.atlassian.net": ... or the npm start wouldn’t actually install the app, leaving me to install and uninstall manually.
Once I added the “https://” I was able to re-run npm start each time i wanted to re-install the app (say to get the ‘Activity’ page to show in the section ‘Build the static Activity page’).

I wasn’t actually able to reproduce the error “Could not find stored client data” however. Did Daniels instructions fix both issues for you?

Cheers,
Melissa