diff --git a/ghost/members-api/lib/repositories/MemberRepository.js b/ghost/members-api/lib/repositories/MemberRepository.js index f3660cebc5..5dbe014994 100644 --- a/ghost/members-api/lib/repositories/MemberRepository.js +++ b/ghost/members-api/lib/repositories/MemberRepository.js @@ -104,8 +104,12 @@ module.exports = class MemberRepository { // Only dispatch the event after the transaction has finished options.transacting.executionPromise.then(async () => { DomainEvents.dispatch(event); - }).catch(() => { + }).catch((err) => { // catches transaction errors/rollback to not dispatch event + logging.error({ + err, + message: `Error dispatching event ${event.constructor.name} for member ${event.data.memberId} after transaction finished` + }); }); } else { DomainEvents.dispatch(event); @@ -1134,6 +1138,11 @@ module.exports = class MemberRepository { attribution: data.attribution, batchId: options.batch_id }); + + if (offerId) { + logging.info(`Dispatching ${event.constructor.name} for member ${member.id} with offer ${offerId}`); + } + this.dispatchEvent(event, options); if (getStatus(subscriptionModel) === 'active') {