Skip to content

Debugging Node.JS

Peter Chapman edited this page Feb 4, 2025 · 12 revisions

Depending on the environment, there are different levels of debugging that can be performed on the Realtime Server

Development

You can enable debugging of the Realtime Server by adding the following entry to your usersecrets.json file:

"node-options": "--inspect=9230"

Then, open chrome://inspect in your browser, and click "Open dedicated DevTools for Node".

QA/Production

On QA and production, you are limited to generating heap snapshots and CPU profiles for 30 seconds at a time.

Generating a heap snapshot and CPU profile:

  1. Get the process id of node: ps aux | grep node

  2. Send the USR2 signal to the node process: sudo kill -USR2 {process_id_here}

    Note: Make sure you are sending it to the node process - sending USR2 to the dotnet process will restart the .NET application.

Wait up to a minute for the heap snapshot and CPU profile to be generated.

These will be created in the app directory, and named:

  • scriptureforge.heapsnapshot
  • profile.cpuprofile

Download them via SCP once created.

Clone this wiki locally