Search code examples
debuggingfirebasegoogle-cloud-functionsgoogle-cloud-debugger

Unable to debug firebase functions


I am trying to debug my js code the runs on firebase functions. My steps were: install from functions

npm install --save @google-cloud/debug-agent

added index.js:

require('@google/cloud-debug').start();

when I tryed to run

firebase deploy --only functions

got an error :

Error: Error parsing triggers: Cannot find module '@google/cloud-debu
g'

Try running "npm install" in your functions directory before deployin

Solution

  • The addition to index.js should be:

    require('@google-cloud/debug-agent').start();

    or better:

    require('@google-cloud/debug-agent').start({ allowExpressions: true });

    We recently renamed the module, and it is possible that the instructions you are following are partially out of date. Can you point us to the instructions you have been following?

    Also note that support for debugging cloud functions is experimental at this point. There are certain cases (dependent on the traffic to the function) where you function may finish before the debug-agent has a chance to initialize/register. We're currently looking into how to address this.