Search code examples
node.jsfirebasegoogle-chrome-devtoolsfirebase-cli

using node --inspect to attach Firebase emulated functions to browser DevTools


I'm attempting to use node --inspect to attach my index.js Firebase functions to chrome devtools for a richer debugging experience than the terminal logs offer.

So far I've met with no success; here's what I've tried:

  1. simply running either firebase serve and firebase emulators:start (but Chrome devtools does not seem to detect these)

  2. running node --inspect against functions/index.js, which serves it on localhost:9229, but not in the context of the emulator, which I need for the other services (hosting, firestore).

  3. reading the node docs and this SO post: Can't debug node.js using Chrome DevTools

I'm not sure whether

  • (a) I'm missing something basic (highly likely),
  • (b) it isn't possible to attach the functions emulator to browser devtools, or
  • (c) it's possible, but bugged or not implemented (in which case I'll open a bug/feature request with firebase-tools).

Any direction appreciated.


Solution

  • This was just added in version 7.11.0 of the Firebase CLI (see release notes). You need to run:

    firebase emulators:start --inspect-functions