diff --git a/core/api/src/services/notifications/index.ts b/core/api/src/services/notifications/index.ts index 8555d299cf0..b1f53234bca 100644 --- a/core/api/src/services/notifications/index.ts +++ b/core/api/src/services/notifications/index.ts @@ -207,7 +207,7 @@ export const NotificationsService = (): INotificationsService => { accountId: recipient.accountId, walletId: recipient.walletId, eventType, - payload: transaction, + payload: { transaction }, }) if (result instanceof Error) return result diff --git a/core/api/src/services/svix/index.ts b/core/api/src/services/svix/index.ts index 0a3e706096a..d4a2de593fc 100644 --- a/core/api/src/services/svix/index.ts +++ b/core/api/src/services/svix/index.ts @@ -81,19 +81,24 @@ export const CallbackService = (config: SvixConfig) => { walletId: WalletId payload: Record }) => { - const accountCallbackId = getAccountCallbackId(accountId) - addAttributesToCurrentSpan({ "callback.application": accountCallbackId }) + try { + const accountCallbackId = getAccountCallbackId(accountId) + addAttributesToCurrentSpan({ "callback.application": accountCallbackId }) - const res = await createApplication(accountCallbackId) - if (res instanceof Error) return res + const result = await createApplication(accountCallbackId) + if (result instanceof Error) return result - try { + const safePayload = JSON.parse( + JSON.stringify(payload, (_key, value) => + typeof value === "bigint" ? value.toString() : value, + ), + ) const res = await svix.message.create(accountCallbackId, { eventType, - payload: { ...payload, accountId, walletId, eventType }, + payload: { ...safePayload, accountId, walletId, eventType }, }) - const prefixedPayload = prefixObjectKeys(payload, "callback.payload.") + const prefixedPayload = prefixObjectKeys(safePayload, "callback.payload") addAttributesToCurrentSpan({ ...prefixedPayload, ["callback.accountId"]: accountId,