Skip to content
This repository was archived by the owner on May 15, 2019. It is now read-only.

Debugging with Chrome DevTools

Jason Dobry edited this page Jan 31, 2017 · 22 revisions

Table of Contents

The Chrome DevTools Debugger

The Chrome DevTools are a set of web authoring and debugging tools built into Google Chrome. As of Node.js v6.3.1 you can use the DevTools to debug and profile your Node.js code.

Debugging functions in childprocess isolation mode

In `childprocess isolation mode, functions are invoked in their own processes, separate from the main Emulator process. This is more secure and safer for the Emulator, but it means the debugger is started on function invocation.

  1. Switch to childprocess isolation mode.

     functions config set isolation childprocess
    
  2. Enable debugging:

     functions config set inspect true
    
  3. Restart the Emulator:

     functions restart
    

    You should see something like the following printed to the console:

     Inspect mode is enabled for the Supervisor. During function execution the debugger will listen on port 9229 and the Chrome debugging URL will be printed to the console.
    
  4. Deploy a function.

  5. Call the function.

    You should see something like the following printed to the console:

     Function execution paused. Connect to the debugger on port 9229 (e.g. using the "node2" launch type in VSCode), or open the following URL in Chrome:
    
         chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/fae86ac1-2e59-46b8-9b08-3e997104662c
    
  6. Paste the printed chrome-devtools URI into a new tab in Chrome.

  7. Script execution will be paused on the first line of the Emulator's worker.js file.

Debugging functions in inprocess isolation mode

TODO

Additional Chrome DevTools reading

Clone this wiki locally