1

I followed the step-by-step guide here.

I made a simple app that posts a message to the rooms the Integration is installed on per a regex (as described in the tutorial above).

When I initially add the Integration to a hipchat room, it works fine. However, after a period of time it stops working.

The following error appears in my Heroku logs:

JWT verification error: 400 Request can't be verified without an OAuth secret

I assume something with my configuration is wrong or my lack-of-use-of-OAuth, but after googling around I can't find any specific answers on what it should look like.

My config.json looks like this:

    "production": {
    "usePublicKey": true,
    "port": "$PORT",
    "store": {
        "adapter": "jugglingdb",
        "type": "sqlite3",
        "database": "store.db"
    },
    "whitelist": [
        "*.hipchat.com"
    ]
},

And my request handler looks like this:

app.post('/foo',
    addon.authenticate(),
    function (req, res) {
      hipchat.sendMessage(req.clientInfo, req.identity.roomId, 'bar')
        .then(function (data) {
          res.sendStatus(200);
        });
    }
);

Any specific direction on configuration and use of Oauth for Hipchat and Heroku would be amazing!

mattrowsboats
  • 582
  • 1
  • 6
  • 14

2 Answers2

0

I personally haven't used the jugglingdb adapter with Heroku and don't know if you can actually look into the database, but it seems like somewhere along the way clientInfo disappears from the store.

My suggestion is to start testing locally with ngrok and redis, so that you can troubleshoot locally and then push the working code to Heroku.

  • Thanks so much Nick. It was indeed an issue with my database connection. I'll submit an answer that has what exactly was wrong, but your comment gave me the push I needed in the right direction of "where exactly should I start investigating next". Thanks! – mattrowsboats Mar 02 '17 at 20:16
  • Glad to hear that Matt! Would you mind adding this to your thread on answers.atlassian, where I originally found it? For some reason, I wasn't able to comment there: https://answers.atlassian.com/questions/56491009/how-can-i-get-my-hipchat-integration-on-heroku-to-authenticate – Nick Turskyi Mar 03 '17 at 10:58
0

Three things I needed to do in order to fix my problem:

  1. Install the Heroku Redis add-on for my Heroku App. (confirm that the Environment Variable for ($REDIS_URL) was added to your app settings).
  2. Add this line to my app.js file:

    ac.store.register('redis', require('atlassian-connect-express-redis'));

  3. Change the production.store object in the config.json to be the following:

    "store": { "adapter": "redis", "url": "$REDIS_URL" },

mattrowsboats
  • 582
  • 1
  • 6
  • 14