Debugging
Run a Point Network Node in a VS Code Debugger
NOTE: You need to setup your local dev environment first.
To debug the Point Network node in VS code:
In your local pointnetowrk node folder, generate compiled typescript sourcemap files by running:
npm run build -- --sourcemap
This will create a dist
directory including *.js.map
files which are used by the VS Code debugger.
- Open VS Code
- Open the Debugger tool
- Click
create a launch.json
file (located under the blue "Run and Debug" button) - Select 'Node JS' from the environment drop down
- Replace the file created with the sample
launch.json
file shown below. - Make sure all the dependent dev services are running such as Arlocal and Ganache (as per the local dev environment setup instructions)
- Click the 'Play' icon next to 'Launch Program' dropdown on the top left
- Open a 'Debug Console' tab in VS Code and you will see the running Point Node logs
- Add a breakpoint to any part of the Point Node JS code (perhaps in one of the common handlers in the client proxy)
- Open the Point Browser by running the alias
point-browser-owner
- Now you can inspect the variables in VS Code and use the debugger as usual.
- Continue to add breakpoints where you need to assist with your build-debugging!
Sample launch.json file
Below is a sample launch.json
file that you can use. Its the same as the one generated by VS code with the outputCapture
key added:
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Point Node",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/point",
"outputCapture": "std",
"env": {
"NODE_CONFIG_ENV": "devlocal",
"MODE": "zappdev"
}
}
]
}