Skip to main content

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.

  1. Open VS Code
  2. Open the Debugger tool
  3. Click create a launch.json file (located under the blue "Run and Debug" button)
  4. Select 'Node JS' from the environment drop down
  5. Replace the file created with the sample launch.json file shown below.
  6. Make sure all the dependent dev services are running such as Arlocal and Ganache (as per the local dev environment setup instructions)
  7. Click the 'Play' icon next to 'Launch Program' dropdown on the top left
  8. Open a 'Debug Console' tab in VS Code and you will see the running Point Node logs
  9. Add a breakpoint to any part of the Point Node JS code (perhaps in one of the common handlers in the client proxy)
  10. Open the Point Browser by running the alias point-browser-owner
  11. Now you can inspect the variables in VS Code and use the debugger as usual.
  12. 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"
}
}
]
}