feat: add webhooks listen command for local development#51
Merged
felipefreitag merged 6 commits intomainfrom Mar 12, 2026
Merged
feat: add webhooks listen command for local development#51felipefreitag merged 6 commits intomainfrom
felipefreitag merged 6 commits intomainfrom
Conversation
Adds a `resend webhooks listen` command that starts a local HTTP server, registers a temporary Resend webhook, displays incoming events in the terminal, and optionally forwards payloads to a local URL. Uses node:http createServer and picocolors (matching the project runtime).
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/commands/webhooks/listen.ts">
<violation number="1" location="src/commands/webhooks/listen.ts:271">
P2: Handle `server.listen` errors so port-binding failures are reported cleanly.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
vcapretz
approved these changes
Mar 12, 2026
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/commands/webhooks/listen.ts">
<violation number="1" location="src/commands/webhooks/listen.ts:282">
P2: Use a one-time startup error handler (or remove it after listen) so later server errors are not silently swallowed.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+282
to
+283
| server.on('error', reject); | ||
| server.listen(port, resolve); |
Contributor
There was a problem hiding this comment.
P2: Use a one-time startup error handler (or remove it after listen) so later server errors are not silently swallowed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/webhooks/listen.ts, line 282:
<comment>Use a one-time startup error handler (or remove it after listen) so later server errors are not silently swallowed.</comment>
<file context>
@@ -277,9 +277,23 @@ For example, if using ngrok: ngrok http 4318`,
- });
+ try {
+ await new Promise<void>((resolve, reject) => {
+ server.on('error', reject);
+ server.listen(port, resolve);
+ });
</file context>
Suggested change
| server.on('error', reject); | |
| server.listen(port, resolve); | |
| server.once('error', reject); | |
| server.listen(port, () => { | |
| server.off('error', reject); | |
| resolve(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
resend webhooks listencommand that starts a local HTTP server, registers a temporary Resend webhook, displays incoming events in the terminal, and optionally forwards payloads to a local URL.