mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-23 16:22:21 +03:00
fix(server): respond stripe webhook immediately
This commit is contained in:
parent
2e4f6ef2ed
commit
7ecee01d20
@ -64,9 +64,14 @@ export class StripeWebhook {
|
||||
`[${event.id}] Stripe Webhook {${event.type}} received.`
|
||||
);
|
||||
|
||||
// handle duplicated events?
|
||||
// see https://stripe.com/docs/webhooks#handle-duplicate-events
|
||||
await this.event.emitAsync(event.type, event.data.object);
|
||||
// Stripe requires responseing webhook immediately and handle event asynchronously.
|
||||
setImmediate(() => {
|
||||
// handle duplicated events?
|
||||
// see https://stripe.com/docs/webhooks#handle-duplicate-events
|
||||
this.event.emitAsync(event.type, event.data.object).catch(e => {
|
||||
this.logger.error('Failed to handle Stripe Webhook event.', e);
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
this.logger.error('Stripe Webhook error', err);
|
||||
throw new NotAcceptableException();
|
||||
|
Loading…
Reference in New Issue
Block a user