mirror of
https://github.com/OutlineFoundation/outline-server.git
synced 2026-08-27 03:42:01 +00:00
chore(sentry_webhook): add basic logs to the webhook so we can debug the pipeline based on event ID (#1454)
* Add some basic logs so we can cross-reference events. * Add `is-processed` response header. * Prevent log injection. * Log response header at DEBUG level.
This commit is contained in:
parent
41d498f228
commit
094eeb3570
2 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
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);
|
||||
res.status(200).send();
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
|
|||
|
|
@ -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}`));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue