Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/webhook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Handle only webhook events
export const handler = async (event, context) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider adding error handling for unknown event types to avoid silent failures

The handler should explicitly handle cases where event.type doesn't match any known types, perhaps by throwing an error or returning an appropriate error response. This will make debugging easier and provide better visibility into invalid webhook calls.

console.log("Event: ", event);
console.log("Context: ", context);
const { changelog } = event;
console.log("Changelog: ", changelog);

if (event.type === "avi:jira:created:issue") {
return handleIssueCreated(event);
}

if (event.type === "avi:jira:updated:issue") {
return handleIssueUpdated(event);
}
};

const handleIssueCreated = async (event) => {
console.log("Issue created");
};

const handleIssueUpdated = async (event) => {
console.log("Issue updated");
};
Loading