Skip to content

feat: add webhooks listen command for local development#51

Merged
felipefreitag merged 6 commits intomainfrom
worktree-webhooks-listen
Mar 12, 2026
Merged

feat: add webhooks listen command for local development#51
felipefreitag merged 6 commits intomainfrom
worktree-webhooks-listen

Conversation

@felipefreitag
Copy link
Contributor

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.

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).
Copy link
Contributor

@cubic-dev-ai cubic-dev-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.

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.

@felipefreitag felipefreitag requested a review from vcapretz March 12, 2026 14:27
@felipefreitag felipefreitag merged commit 2258aa3 into main Mar 12, 2026
5 checks passed
@felipefreitag felipefreitag deleted the worktree-webhooks-listen branch March 12, 2026 14:37
Copy link
Contributor

@cubic-dev-ai cubic-dev-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.

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);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 12, 2026

Choose a reason for hiding this comment

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

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();
});
Fix with Cubic

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.

2 participants