What is best way to connect my debugger to my development nodebb?
-
I've successfully run nodebb in webstorm. At this point I've tried a short list of directives "plugins", "start", "stop", etc.
I've single stepped and have gotten to the point where it forks a new process on start. I've then verified that it successfully starts nodebb in the forked process, and I have a full featured nodebb at that point.
I also noticed that there is a dev option that can be set. I'm not quite sure when that is useful during development. For example I was wondering if that makes attaching to the forked process simpler.
Part of why I want to run in the debugger is because I need to integrate with Keycloak, and would like to use the OAuth plugin for that purpose. Given that integration with Keycloak has not been verified, I wanted to prepare myself for any debug that I might need to do to support reporting my findings.
I also wanted to see if a simple nodebb side change fixes the SocketIO/CORS issue that I've been struggling with.
Anyways, having used forked processes often in the past, I was wondering if you typically will attach to the forked process, or do you use a different means to single step in the forked process.
Also if you do attach, how do you determine the process id to attach to with a node based application?
Lastly, if you can highlight when you typically turn on that debug flag, i'd appreciate it. It seems that when using "dev" the "--no-daemon" option is used that suggests that maybe nodebb is not forked?
Thanks in advance.
-
loader.js
is mostly used in production to fork multiple nodebbs, you can probably point your debugger at app.js and start there. In vscode my launch.json looks like this.{ // 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": [ { "type": "node", "request": "launch", "name": "NodeBB", "skipFiles": [ "${workspaceFolder}\\node_modules\\**\\*.js", "${workspaceFolder}\\src\\promisify.js", "<node_internals>/**" ], "program": "${workspaceFolder}\\app.js", "runtimeArgs": [ "--trace-warnings", "--stack-trace-limit=200" ] } ] }
I modify
skipFiles
array depending on if I want to step into node_modules like nbb plugins etc. -
@baris Cool beans! Ill try it.
Is there a special configuration that you use when you are developing plugins? I'm specifically interested in making some fast progress with that OAuth2 plugin, and a Keycloak integration -
@baris
There is nothing I need to do to activate the plugin? I would think that somehow nodebb must be configured to discover the plugin?