Is anybody else having trouble running the Forge debugger? It has worked for me in the past, but now…not so much. Here’s how I’m running Forge tunnel:
forge tunnel --debug --debugFunctionHandlers index.onIssueUpdated --debugStartingPort 9229
And everything seems to start up all right.
=== Running forge lint...
No issues found.
=== Bundling code...
✔ Functions bundled.
✔ Resources bundled.
✔ Resources bundled.
Listening for requests...
Debugger listening on ws://0.0.0.0:9229/b70b74fd-728f-4ede-b286-9bfff0bd8461
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
invocation: 67e4d0f304403432d875144560963044 index.onIssueUpdated
You can see that the debugger is attached just fine.
But my debugger - I’m using IntelliJ IDEA - doesn’t get triggered. By that I mean that execution isn’t paused at the breakpoints I’ve set.
I’m at a loss to explain what has happened. Am I alone in this?
I used VSCode and was able to get it to stop at breakpoints in synchronous resolvers; however as soon as I started putting events on an async event queue, the debugger wouldn’t stop at the resolver’s breakpoints. I assume this had something to do with multiple processes running and the debugger only attaching to a primary process or something like that, but I needed to move on, so I never got to the root cause. I was able work around it with print statements, but it’s definitely suboptimal. Would be good if someone on the Forge dev team could confirm if they have this working.
1 Like
I don’t know if this is relevant, but I’m seeing these errors in the developer console:
(node:8) [DEP0040] DeprecationWarning: The punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
I just updated to CLI 11.2.0. Still getting the punycode deprecation warning, just FYI.
1 Like
@david.pinn Please follow https://developer.atlassian.com/platform/forge/debug-functions-using-intellij/.
If it still has problem, could you record the steps on how you run debugger. Once the debugger attached, if you don’t see the debugger stops in the first trigger, please trigger the function again.
@lead_crimsalytics if you want to debug the async event, please make sure include the function which implements the async event in the debugger command
so something like
forge tunnel --debug --debugFunctionHandlers handlerTriggerAsyncEvent handlerConsumeAsyncEvent --debugStartingPort 9229
If we run above command:
- handlerTriggerAsyncEvent → debugger on port 9229
- handlerConsumeAsyncEvent → debugger on port 9230
We also can run it simpler as below where we only want to debug the handlerConsumeAsyncEvent
forge tunnel --debug --debugFunctionHandlers handlerConsumeAsyncEvent --debugStartingPort 9229
2 Likes
I flailed around for a long time, but I now have the stepwise debugger working. I believe the culprit was the lack of some import React from 'react'
statements in our static app. That was causing some JavaScript errors and may have sent the Forge runtime into a tailspin.
1 Like