firebase / firebase/firebase-tools

Support FireAlerts Functions in the Firebase Emulator Suite

Open
#5,390 2 comments 0 reactions 0 assignees View on GitHub
emulators: functions type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

When I use commands:firebase emulators:start --only functions
The http function can detect, but the warning function cannot detect, and there is no error prompt.
![Uploading 1672819521805.jpg…]()

my alert function is as follow.

exports.postfatalissuetodiscord = onNewFatalIssuePublished(async (event) => {
// [END v2CrashlyticsAlertTrigger]
// [START v2CrashlyticsEventPayload]
// construct a helpful message to send to Discord
const appId = event.appId;
const {id, title, subtitle, appVersion} = event.data.payload.issue;
const message = `
🚨 New fatal issue for {appVersion} 🚨

${title}

${subtitle}

id: `${id}`
`;
// [END v2CrashlyticsEventPayload]

try {
// [START v2SendToDiscord]
const response = await postMessageToDiscord("Crashlytics Bot", message);
if (response.ok) {
logger.info(
Posted fatal Crashlytics alert ${id} for ${appId} to Discord,
event.data.payload,
);
} else {
throw new Error(response.error);
}
// [END v2SendToDiscord]
} catch (error) {
logger.error(
Unable to post fatal Crashlytics alert ${id} for ${appId} to Discord,
error,
);
}
});

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.