Issue with forge tunnel

Hi having an issue when running forge tunnel

This is the output

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

Error: spawn /Users/benkiani/.nvm/versions/node/v20.13.1/lib/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /Users/benkiani/.nvm/versions/node/v20.13.1/lib/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok',
  path: '/Users/benkiani/.nvm/versions/node/v20.13.1/lib/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok',
  spawnargs: [
    'start',
    '--none',
    '--log=stdout',
    '--config=/Users/benkiani/PycharmProjects/Jira/Hello-world/ngrok.config'
  ]
}

Using MacOS and docker and forge latest

Can anyone help?

Is the ngrok executbale present at the following location?

/Users/benkiani/.nvm/versions/node/v20.13.1/lib/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok

I’m not sure if you’re on the latest Forge CLI version, but if not… try:

npm uninstall -g @forge/cli
npm i -g @forge/cli@latest

Side note: as of the latest Forge runtime, you won’t need Docker to use the tunnel. Just insure that you have the new runtime set in your manifest:

app:
  id: your-app-id
  runtime:
    name: nodejs18.x
2 Likes

Thanks after using -

npm uninstall -g @forge/cli
npm i -g @forge/cli@latest

It worked

1 Like

Hello!

This is also an issue for me.

Once I upgraded to the latest version of Forge CLI (v9.3.0), all the tunnel commands have stopped working.

I get the same error as the OP:

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

node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/foo/dev/jira-poc/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /Users/foo/dev/jira-poc/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok',
  path: '/Users/foo/dev/jira-poc/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok',
  spawnargs: [
    'start',
    '--none',
    '--log=stdout',
    '--config=/Users/foo/Library/Application Support/ngrok/ngrok.yml'
  ]
}

The path it is looking for (/Users/foo/dev/jira-poc/node_modules/@forge/cli/node_modules/ngrok/bin/ngrok) does not exist. The bin directory is empty.

This is after a rm -rf node_modules and fresh npm i. I have tried including the @forge/cli package in my node_modules, and also as a global install using npm i -g @forge/cli@latest. I get the same error.

The only way I could get it to work was to install ngrok with brew, then manually symlink ngrok to the directory required by forge:

ln -s /opt/homebrew/bin/ngrok /Users/foo/dev/jira-poc/node_modules/@forge/cli/node_modules/ngrok/bin/

This is not an ideal workaround.

Many thanks for any help you can provide!