Failed to establish local tunnel in Jira Activity Tutorial

Relatively new dev here, and very new to Jira addons. I’ve gone through the Hello World tutorial fine, but now on the Jira Activity tutorial:

When I run npm start, I get the following log with the error at the bottom:

Failed to establish local tunnel
err = Error: connect ECONNREFUSED
Error: connect ECONNREFUSED
Error: connect ECONNREFUSED
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)

I’ve tried following some fixed on this thread: Error: ngrok is not yet ready to start tunnels, but the issue is still there. I’ve also checked that my firewalls are off. I’m wondering if the problem is on my end or if its an ACE configuration issue.

Any tips are welcome!


@JasonFu - can’t recreate the problem. I followed the tutorial from scratch. Do you have any other issues running local services on localhost? (i.e. nginx or Apache) What OS are you running?

I honestly wish I had tried this before posting, but I did the classic turn it off then back on, then npm rebuild. Now I can’t recreate the issue either. Just to answer the questions for posterity, I have a MBP on Mojave and I was running Apache and Nginx on 8080 and 8888 fine, but it was just that 4041 port that gave me errors. Thanks for following up!


Woot. Glad that you’re unblocked.

1 Like

I am having this exact same problem right now. Just following the tutorial, I get this “Failed to establish local tunnel” error constantly… and then suddenly I don’t?.. and then it comes back again with literally no code change.

I’ve turned it on and off again, to no avail.
I’ve done the tutorial last week without any issues. It just started today, doing the tutorial again from scratch.

This is a MBP running Mojave. I’m not running Apache or any other services.
Usually it manifests as

Failed to establish local tunnel
err = Error: [object Object]

but sometimes it is

Failed to establish local tunnel
err = Error: connect ECONNREFUSED
Error: connect ECONNREFUSED
Error: connect ECONNREFUSED
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)

and for a short time I added some logging lines to register-jira-conf.js and the problem went away? Then I removed the logging lines and the problem reappeared. I added back the logging lines and… problem persisted? So I don’t know what’s happening here.

@ChristopherDrum were you able to solve the problem?

I am getting this issue too, but only if I configured npm run dev with nodemon.

After tracing the issue, it was related to the fact that Im using a ngrok free account, which allows me to open a single ngrok tunnel.
Then, when the server is automatically restarted (for instance, when I updated my code and saved my code file), somehow node_modules/atlassian-connect-express/lib/internal/registration/register-jira-conf.js from ACE is not killing the first ngrok instance.

Hence, ngrok tries to open instead of, which will fail for the cause previously mentioned (ngrok free account).

It all went to this function of the ACE code:

function requireNgrok() {
    return require('../require-optional').requireOptional('ngrok');
exports.deregister = function () {
    promise.finally(function () {
      requireNgrok().then(function (ngrok) {
            console.log('IT NEVER GETS HERE')

Then, if I check this file node_modules/atlassian-connect-express/lib/internal/require-optional.js

exports.requireOptional = function requireOptional(moduleName) {
    return new RSVP.Promise(function (resolve, reject) {
        try {
           console.log('IT RESOLVES THIS MODULE CORRECTLY')
        } catch (err) {

So, somehow requireNgrok() function is not resolving the ngrok module correctly when deregistering and then it never kills ngrok.

In the other hand, a very similar code works fine in the same register-jira-conf.js file in the createTunnel function.

Does anyone have any ideas? For me, it’s a clear bug from ACE, but not sure if it’s related to a bug in RSVP too.

PD: Im using MacOS Catalina Version 10.15.5 and
“atlassian-connect-express”: “^3.5.0”,
“devDependencies”: {
“eslint”: “^5.16.0”,
“ngrok”: “^3.3.0”,
“nodemon”: “^1.19.4”,
“sqlite3”: “^4.2.0”

However, I see that ACE 3.5.0 is using "ngrok": "^3.2.4" and "rsvp": "^4.8.5" instead. Not sure if that’s related


This solved it. I had a node app running and a local server hosted with ngrok. Must’ve blocked it or something

1 Like

I also got this error.
I already had a tunnel established for another app. Had to close that tunnel to resolve this.
Root cause: ngrok free plan allows only one online ngrok process.