Skip to content

Add a webhook sample index.js #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Add a webhook sample index.js #23

merged 1 commit into from
Dec 10, 2024

Conversation

hiroshinishio
Copy link
Contributor

No description provided.

@hiroshinishio hiroshinishio merged commit 9c6e045 into main Dec 10, 2024
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch December 10, 2024 08:21
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hiroshinishio - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding error handling for malformed events and unexpected event types
  • Replace console.log statements with proper logging mechanism suitable for production
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant