Forge tunnel debug mode doesn't start

Hello,

I’ve followed the guide to enable debuggin using Visual Code: https://developer.atlassian.com/platform/forge/debug-functions-using-vscode/

But if I start the tunnel with the debug options nothing happens:

forge tunnel --debug --debugFunctionHandlers index.handler --debugStartingPort 9229

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.


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

=== Bundling code...
✔ Functions bundled.

Listening for requests...

Following the documentation a message similar to this should occurs:

Debugger listening on ws://0.0.0.0:9229/8d29c246-2186-4e20-9851-4aa609a3b890
For help, see: https://nodejs.org/en/docs/inspector

But this doesn’t happen. As a result, the attempt to attach the Visual Studio Code debugger fails.

I have created a launch configuration (stored in .vscode in the same project):

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Attach Forge App Debugger",
          "port": 9229,
          "request": "attach",
          "type": "node",
          "sourceMaps": true
      }
  ]
}

And I have the runtime enabled:

app:
  runtime:
    name: nodejs20.x

Some versions:
Node: 20.17.0
Forge: 10.5.0

Has anyone any hint to get debugging running?

Thanks
Thorsten

Your launch.json looks right.

Be sure you’ve got the right handler name. For example, I have:

modules:
  function:
    - key: admin-resolver
      handler: index.adminResolver

And my command line is:

forge tunnel -d -f index.adminResolver
1 Like

F**k :smile:

Indeed, the handler name was the reason. I have not checked, because I have tested with a standard forge app coming from one of the forge generated projects.