-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix/mollie failing webhook #3014
Fix/mollie failing webhook #3014
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
}, | ||
}); | ||
expect(createPaymentMethod.code).toBe(mockData.methodCode); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved to top, because payment method creation should happen before creating orders
if (!paymentWithSameTransactionId) { | ||
// The order is paid for again, with another transaction ID. This means the customer paid twice | ||
Logger.error( | ||
`Order '${order.code}' is already paid. Mollie order '${mollieOrder.id}' should be refunded.`, | ||
loggerCtx, | ||
); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can tap into this error log and automatically report this to Sentry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we have done in one of our projects is to create a SentryLogger
that is a wrapper around a VendureLogger
, which sends all error logs to Sentry. You could use a similar approach and filter out only this message. We could add a prefix/constant in the log message to make sure that is always in the error message.
// Error function in our SentryLogger class
error(message: string, context?: string | undefined, trace?: string | undefined,
): void {
Sentry.captureMessage(message, "error");
this.logger.error(message, context, trace);
}
Any alternative suggestions welcome, but I dont think there is any error emitting way of working in Vendure currently?
The alternative is to throw an error that you can handle somewhere, but this will also make Mollie retry this webhook until we return a status 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the wrapper logger would work well, since I also need it for some other logs. Thanks for the suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message is checked in the test. I will add a comment that the message shouldn't be changed because monitoring can depend on it.
Thanks for the fix! I'll be publishing a patch this week. |
Description
Fixes #2941
Breaking changes
Removed
order.customFields.mollieOrderId
, because we dont need a reference to Mollie anymore, but a migration is not per se needed, because its only a field removal.Screenshots
Checklist
📌 Always:
👍 Most of the time: