1
votes

I want to connect the stackdriver debug agent in the cloud functions for firebase. The following is how I did set up the stackdriver agent to use on the start on the functions I want to debug.

// For debugging purposes
const debug = require('@google-cloud/debug-agent').start({  allowExpressions: true,
});

export async function listen() {
     await debug.isReady();
}

Then use it like the following

export async function exampleCallableWrapper(
  data: any,
  context: functions.https.CallableContext
) {
  await listen();
  data.Id = shortid.generate();
// Do something

  return 
}

I want to see the data object for example. The snapshot doesn't show anything after putting the breakpoint.

  • I did put the breakpoint in the original functions/src folder where the function is located.

  • I also tried to point it on the lib folder manually with no luck as I had to do it manually.

  • I did see the function start and return ok successfully with no problem but nothing to show in the stackdriver debugger page

The versions of functions and stackdriver are as follows

"@google-cloud/debug-agent": "^3.0.0",

"firebase-functions": "^2.0.5",
1

1 Answers

0
votes

This solution implement Stackdriver Debugger with Cloud Function. It might be useful to review how they implement it versus your code.