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. For example, you could notify your team's slack channel when a new issue pops up, or warn users about a major outage in response to a velocity alert.

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:

functiondescription
onNewDetected()

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

exports.sendOnNew = functions.crashlytics.issue()
                                         .onNewDetected(event => {
// ...
});
onRegressed()

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

exports.sendOnRegressed = functions.crashlytics.issue()
                                               .onRegressed(event => {
// ...
});
onVelocityAlert()

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

exports.sendOnVelocityAlert = functions.crashlytics.issue()
                                                   .onVelocityAlert(event => {
// ...
});

Access event attributes

Each event triger created with IssueBuilder returns an Issue with properties 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.postOnIssueCreate = functions.crashlytics.issue().onNewDetected(event => {
  const { data } = event;
  issueId = data.issueId;
  issueTitle = data.issueTitle;
  const slackMessage = ` There's a new issue (${issueId}) ` +
      `in your app - ${issueTitle}`;
  return notifySlack(slackMessage).then(() => {
    console.log(`Posted new issue ${issueId} successfully to Slack`);
  });
});

Send feedback about...

Need help? Visit our support page.