Truy cập vào bảng điều khiển

Extend Firebase Crashlytics with Cloud Functions

You can trigger a function in response to Crashlytics issue events including new issues, regressed issues, and velocity alerts. Here are a few things you could do in response to an issue event:

For more examples of use cases, see What can I do with Cloud Functions?

Trigger a Crashlytics function

To trigger a Crashlytics function, first generate an IssueBuilder with functions.crashlytics.issue(), then call the builder's appropriate issue-generation function:


New issue events trigger when your app experiences an issue for the first time.

exports.sendOnNewIssue = functions.crashlytics.issue().onNew(async (issue) => {
  // ...

Regressed issue events trigger when an issue reoccurs after it's closed in Crashlytics. Example:

exports.sendOnRegressedIssue = functions.crashlytics.issue().onRegressed(async (issue) => {
  // ...

Velocity alert events trigger when a statistically significant number of sessions in a given build crash. Example:

exports.sendOnVelocityAlert = functions.crashlytics.issue().onVelocityAlert(async (issue) => {
  // ...

Access event attributes

Each event triger created with IssueBuilder returns an Issue with properties that include the issue's name, ID, relevant app info, and more.

For example, when your app experiences a new issue, you could send a message to Slack with the issue's ID and title:

exports.postOnNewIssue = functions.crashlytics.issue().onNew(async (issue) => {
  const issueId = issue.issueId;
  const issueTitle = issue.issueTitle;
  const appName = issue.appInfo.appName;
  const appPlatform = issue.appInfo.appPlatform;
  const latestAppVersion = issue.appInfo.latestAppVersion;

  const slackMessage = `<!here|here> There is a new issue - ${issueTitle} (${issueId}) ` +
      `in ${appName}, version ${latestAppVersion} on ${appPlatform}`;

  await notifySlack(slackMessage);
  console.log(`Posted new issue ${issueId} successfully to Slack`);