Skip to content

Commit

Permalink
fix: webhook event parsing bug (#1874)
Browse files Browse the repository at this point in the history
  • Loading branch information
shineli1984 authored Jun 6, 2024
1 parent 1d9cdf2 commit b8fdd7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/webhook/sdk/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export const handle = async (
});
});

const event = JSON.parse(msg.Message);
if (msg.Type === 'Notification') {
// the msg.Message is only a valid JSON string when the message is of Type Notification
const event = JSON.parse(msg.Message);
switch (event.event_name) {
case 'imtbl_zkevm_mint_request_updated':
if (handlers?.zkevmMintRequestUpdated) {
Expand Down Expand Up @@ -176,7 +177,8 @@ export const handle = async (
if (handlers?.all) {
await handlers?.all(event);
}
return event;
}

return event;
return null;
};

0 comments on commit b8fdd7e

Please sign in to comment.