Forge JIRA Tutorial: "Error: Failed to start tunnel, could not establish a connection."

Hi All,
I am following the JIRA Hello World App tutorial:

https://developer.atlassian.com/platform/forge/build-a-hello-world-app-in-jira/

Last night I completed part 1 and all was well. However this morning (UK) my system could no longer use forge tunnel. The error I get is (with --verbose):

Error: Failed to start tunnel, could not establish a connection.

Error: Failed to start tunnel, could not establish a connection.
at NgrokTunnelFactory.establishTunnel (/tunnel/node_modules/@forge/tunnel/out/tunnelling/tunnel-factory.js:24:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

I am using:

  • Windows 10 (10.0.19042 Build 19042). Docker and Node.js were installed last night and seem to be fine.
  • Docker version 20.10.5
  • Node JS 12…21.0

I have created a new app (hello-world2) to see if this still occurs. And I am struggling to get past this.

Are there any known firewall issues perhaps?

Any ideas?

1 Like

Hey @RogerGodfrey I got the same issue

Press Ctrl+C to cancel.

Checking Docker image... 100%
Your Docker image is up to date.
▶️  GraphQL https://api.atlassian.com/graphql
Query:
     mutation deleteTunnels($input: DeleteAppTunnelInput!) {
       deleteAppTunnels(input: $input) {
         statusCode
         success
         message
         errorDetails {
           code
         }
       }
     }

Variables: {
 "input": {
   "appId": "ari:cloud:ecosystem::app/5e8447a8-b53e-4351-8a1c-4929efdc2c33",
   "environmentKey": "default"
 }
}
◀️  GraphQL
Request ID: e5572db303306a08
Result: {
 "deleteAppTunnels": {
   "statusCode": 200,
   "success": true,
   "message": "Deleted tunnel for app 5e8447a8-b53e-4351-8a1c-4929efdc2c33 in environment default",
   "errorDetails": null
 }
}

Error: Failed to start tunnel, could not establish a connection.

Error: Failed to start tunnel, could not establish a connection.
   at NgrokTunnelFactory.establishTunnel (/tunnel/node_modules/@forge/tunnel/out/tunnelling/tunnel-factory.js:24:19)
   at processTicksAndRejections (internal/process/task_queues.js:97:5)

on my setup:
Ubuntu 18.04
Docker version 19.03.13, build 4484c46d9d
Node v12.17.0
Forge 1.2.0

Hi @santiago,

Glad it is not just me. :slight_smile:

Looks identical. I am wondering if could this be an infrastructure problem on the Atlassian side.

Hey @RogerGodfrey,

Glad you’re going through our Forge tutorials. I was not able to reproduce this problem. It’s possible that we had some infra issues when you tried.

Please let us know if the issue persists for you.

Happy Forging :slight_smile:

Hi @Aryan
This is still occurring for me. I have just tried uninstalling, redeploying and reinstalling.

One thing I may have done wrong is I installed Node JS version 14.something originally. I uninstalled this and installed 12.21.0 when I got warnings after grabbing the API in the second tutorial.

This is the verbose output:

PS H:\JIRADev\hello-world-app2> forge tunnel --verbose
Running your app locally with Docker. The tunnel displays your usage from everywhere the app in the development environment is installed.
Press Ctrl+C to cancel.

Checking Docker image... 100%
Your Docker image is up to date.
▶️  GraphQL https://api.atlassian.com/graphql
Query:
      mutation deleteTunnels($input: DeleteAppTunnelInput!) {
        deleteAppTunnels(input: $input) {
          statusCode
          success
          message
          errorDetails {
            code
          }
        }
      }

Variables: {
  "input": {
    "appId": "ari:cloud:ecosystem::app/cdd7a9ab-c3b9-40d0-ba87-7af53735b861",
    "environmentKey": "default"
  }
}
◀️  GraphQL
Request ID: de2e9bf053402ad7
Result: {
  "deleteAppTunnels": {
    "statusCode": 200,
    "success": true,
    "message": "Deleted tunnel for app cdd7a9ab-c3b9-40d0-ba87-7af53735b861 in environment default",
    "errorDetails": null
  }
}

Error: Failed to start tunnel, could not establish a connection.

Error: Failed to start tunnel, could not establish a connection.
    at NgrokTunnelFactory.establishTunnel (/tunnel/node_modules/@forge/tunnel/out/tunnelling/tunnel-factory.js:24:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Currently stuck with this issue… :frowning:

Hey @Aryan, it may have been something on our side . It works fine now :smiley: :partying_face:

~/code/hello-world-confluence-forge master !2 > forge tunnel
Running your app locally with Docker. The tunnel displays your usage from everywhere the app in the development environment is installed.
Press Ctrl+C to cancel.

Checking Docker image... 100%
Your Docker image is up to date.

Reloading code...

=== Running forge lint...
No issues found.

=== Bundling code...
App code bundled.

=== Snapshotting functions...
No log output.

App code reloaded.

Listening for requests...
1 Like

Glad it’s working for you @santiago!

@RogerGodfrey I’ve raised this issue with our Forge team internally and will get back to you with any solutions they suggest. In the meantime, I suggest checking your firewall settings that may be blocking some traffic from your computer (:crossed_fingers:).

1 Like

Hi @Aryan
I tried this earlier (about 14:00 uk time) and it failed. However, trying it just now, the Forge Tunnel command now seems to be working with no issues.

I assume it is some transitional internet issue.

Very strange.

Roger

Glad it’s working for you now @RogerGodfrey.

Just a quote from our engineers:

When you run forge tunnel we try to find an available port to connect to, but I don’t think this takes into account the user’s local network / firewall settings (e.g: if a port is free but blocked by the firewall)

We’ll aim to have more useful error messages in the upcoming versions of the CLI so it’s easier to debug these errors :slight_smile:

As always don’t hesitate to reach out if you have any questions or suggestions about Forge!

Hey @Aryan , I think the issue comes to me now.

forge tunnel --verbose
Running your app locally with Docker. The tunnel displays your usage from everywhere the app in 
the development environment is installed.
Press Ctrl+C to cancel.

Checking Docker image... 100%   
Your Docker image is up to date.
▶️  GraphQL https://api.atlassian.com/graphql
Query:
      mutation deleteTunnels($input: DeleteAppTunnelInput!) {
        deleteAppTunnels(input: $input) {
          success
          errors {
            message
            extensions {
              errorType
            }
          }
        }
      }

Variables: {
  "input": {
    "appId": "ari:cloud:ecosystem::app/9cf5db9d-f810-443f-a442-8f164b48dc58",
    "environmentKey": "default"
  }
}
◀️  GraphQL
Request ID: 9c80aad594502d97
Result: {
  "deleteAppTunnels": {
    "success": true,
    "errors": null
  }
}

Error: Failed to start tunnel, could not establish a connection.

This is my first time setting up Docker Desktop for Windows. Is there any extra configurations I need to setup first then ?

on my setup:
Windows 21H1
Docker version 20.10.7
Node v12.19.0
Forge 1.5.0

Latest Status-----

somehow it worked after reconnecting several times.

}
◀️  GraphQL
Request ID: b137d71694f731b
Result: {
  "createAppTunnels": {
    "success": true,
    "errors": null,
    "keepAlive": "1625849740341"
  }
}

Reloading code...

thanks to Atlassian Team

1 Like

@ejabu Glad it started working for you. Please do reach out again if you experience any issues.

Hi Aryan, I have the exact same problem as described above.

Error: Failed to start tunnel, could not establish a connection.

Error: Failed to start tunnel, could not establish a connection.
    at NgrokCreateTunnelService.establishTunnel (/tunnel/node_modules/@forge/tunnel/out/tunnelling/services/create-tunnel-service.js:24:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async StartTunnelCommand.startFaaSTunnelServer (/tunnel/node_modules/@forge/tunnel/out/tunnelling/command/start-tunnel-command.js:37:35)
    at async StartTunnelCommand.execute (/tunnel/node_modules/@forge/tunnel/out/tunnelling/command/start-tunnel-command.js:70:38)
    at async Object.exports.runTunnel (/tunnel/node_modules/@forge/tunnel/out/index.js:31:24)

I’m running

  • Win 11
  • Docker 20.10.14
  • Node 16.15.0
  • Forge 4.3.1

I’ve tried turning off the firewall completely to verify that isn’t the problem.

I can’t find any information about what to do?

What might be the problem? Is there anything else I can try? Any other log to check?

Hi @ChristoferHellqvist,

This is generally some network issue. Could you try running the command with

forge tunnel --verbose

and send your results here :slight_smile:

Hi, the above error where from running in verbose mode. Here’s the full output

Tunnel redirects requests you make to your local machine. This occurs for any Atlassian site where your app is installed in the development environment. You will not see requests from other users.
Press Ctrl+C to cancel.

Checking Docker image... 100%
Your Docker image is up to date.
▶️  GraphQL https://api.atlassian.com/graphql
Query:
      mutation forge_cli_deleteApplicationTunnels($input: DeleteAppTunnelInput!) {
        deleteAppTunnels(input: $input) {
          success
          errors {
            message
            extensions {
              errorType
            }
          }
        }
      }

Variables: {
  "input": {
    "appId": "ari:cloud:ecosystem::app/d721d10c-2d00-4c64-8b76-190fab077871",
    "environmentKey": "default"
  }
}
◀️  GraphQL
Request ID: a93abd32b64f328a
Result: {
  "deleteAppTunnels": {
    "success": true,
    "errors": null
  }
}

Error: Failed to start tunnel, could not establish a connection.

Error: Failed to start tunnel, could not establish a connection.
    at NgrokCreateTunnelService.establishTunnel (/tunnel/node_modules/@forge/tunnel/out/tunnelling/services/create-tunnel-service.js:24:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async StartTunnelCommand.startFaaSTunnelServer (/tunnel/node_modules/@forge/tunnel/out/tunnelling/command/start-tunnel-command.js:37:35)
    at async StartTunnelCommand.execute (/tunnel/node_modules/@forge/tunnel/out/tunnelling/command/start-tunnel-command.js:70:38)
    at async Object.exports.runTunnel (/tunnel/node_modules/@forge/tunnel/out/index.js:31:24)

I started experiencing same error today.

@MaciejJezierski,

Your problem is most likely a new problem as of today. There are already a couple other threads. I’ll leave this one open in case people need to ask something about the incident:

Otherwise, I’m going to suggest this thread has already wandered a bit. While the general troubleshooting steps here are good, I don’t think we ever pinned down a specific problem with a specific solution; hence, I’m going to lock this thread and encourage the community to open new topics for new problems with Forge tunneling.

Edit: The docs mean what they say. I was wrong about the ngrok aspect see my subsequent correction

Maybe one last “pro tip”… A fundamental workaround is to switch to the native Node.js runtime because, as the docs explain:

The new native Node.js runtime no longer requires a local Docker image for invoking your Forge functions locally. This simplifies the local toolchain for setting up the tunnel, and will improve the performance of your tunnel.

When the runtime leaves preview and becomes GA, I would say this won’t even be a “workaround”. But, during preview, please be aware the new runtime does have some differences and known limitations.

Hello Team,

ngrok have enforced user accounts now. We’ve posted a solution in

James.

1 Like