Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(sentry_webhook): add basic logs to the webhook so we can debug the pipeline based on event ID #1454

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sentry_webhook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ exports.postSentryEventToSalesforce = (req: express.Request, res: express.Respon
if (!sentryEvent) {
return res.status(400).send('Missing Sentry event');
}
const eventId = sentryEvent.event_id?.replace(/\n|\r/g, '');
if (!shouldPostEventToSalesforce(sentryEvent)) {
console.log('Not posting event:', eventId);
Fixed Show fixed Hide fixed
return res.status(200).send();
}
// Use the request message if SentryEvent.message is unpopulated.
sentryEvent.message = sentryEvent.message || req.body.message;
postSentryEventToSalesforce(sentryEvent, req.body.project)
.then(() => {
console.log('Successfully posted event:', eventId);
Fixed Show fixed Hide fixed
sbruens marked this conversation as resolved.
Show resolved Hide resolved
res.status(200).send();
})
.catch((e) => {
Expand Down
1 change: 1 addition & 0 deletions src/sentry_webhook/post_sentry_event_to_salesforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function postSentryEventToSalesforce(event: SentryEvent, project: string)
},
(res) => {
if (res.statusCode === 200) {
console.debug('Salesforce `is-processed`:', res.headers['is-processed']);
resolve();
} else {
reject(new Error(`Failed to post form data, response status: ${res.statusCode}`));
Expand Down