JavaScript debugging tips
wh debug - Various global and JS/TS debugging tools
wh harescript-debug - Legacy HareScipt debug tool
Make sure to enable Developer options in your WebHare personal settings. This will enable various debug applications.
Use all debugging tools at your own risk - debugging may pause or crash important processes, which in turn may affect other processes, webpages or scripts. Do not debug in production unless you absolutely have to.
Chrome Developer tools
We recommend the 'node debugger' application in WebHare to list running JavaScript processes and start the Chrome tools on a specific worker. This will launch a hosted version of the Devtools and offer it a websocket proxy to connect back to the debugged proces. Do not share these tools or the websocket URL with anyone - it gives them effective full sysop access to the server.
If the node debugger fails to work, you can use Chrome's developer tools to debug JavaScript/TypeScript applications:
- Use
wh debug list-processesto list all JavaScript processes known to WebHare. - Use
wh debug list-workers <pid>to list all workers inside a process - Use
wh debug inspect <pid>to inspect the main thread, orwh bridge inspect <pid>.<workernr>to inspect a specific worker. This will give you an URL you can use inchrome://inspect/#workers - Use
wh debug inspect-in-chrome <pid>to attempt to immediately open Canary or Chrome devtools.
We recommend using Canary as eg. memory profiling seems to work better than in normal Chrome.
Live debugging
WebHare node processes offer a $wh object with access to useful APIs/objects inside a running process
You can modify the debugflags of a running process by setting $wh.debugFlags