Skip to content

fix(webhook): do not retry after a successful trigger delivery#2674

Open
WilliamBergamin wants to merge 2 commits into
mainfrom
fix-webhook-retries-after-success
Open

fix(webhook): do not retry after a successful trigger delivery#2674
WilliamBergamin wants to merge 2 commits into
mainfrom
fix-webhook-retries-after-success

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2673.

WebhookTrigger.send() retried after a trigger had already fired. This caused duplicate Workflow Builder runs.

The cause is the success path. It read the body with response.json(). That call throws on an empty or non-JSON 2xx body. The thrown error was wrapped as a WebhookTriggerRequestError, which p-retry treats as retryable. So a trigger that already succeeded got sent again.

The fix reads the 2xx body tolerantly in a new buildResult() method. It mirrors IncomingWebhook.

Requirements

WebhookTrigger.send() read the success body with response.json(), which
throws on an empty or non-JSON 2xx body. That error was wrapped as a
retryable WebhookTriggerRequestError, so a trigger that already fired got
resent, causing duplicate Workflow Builder runs.

Read the 2xx body tolerantly via a new buildResult() that mirrors
IncomingWebhook: an empty or unparseable body resolves to { ok: true },
while a valid JSON body (including { ok: false, error }) is still surfaced.
A genuine mid-body read failure still propagates as retryable.

Fixes #2673

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 16c29e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/webhook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.10%. Comparing base (046647f) to head (16c29e2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2674      +/-   ##
==========================================
- Coverage   89.11%   89.10%   -0.01%     
==========================================
  Files          65       65              
  Lines       10339    10348       +9     
  Branches      471      474       +3     
==========================================
+ Hits         9214     9221       +7     
- Misses       1095     1097       +2     
  Partials       30       30              
Flag Coverage Δ
cli-hooks 89.10% <100.00%> (-0.01%) ⬇️
cli-test 89.10% <100.00%> (-0.01%) ⬇️
logger 89.10% <100.00%> (-0.01%) ⬇️
oauth 89.10% <100.00%> (-0.01%) ⬇️
socket-mode 89.10% <100.00%> (-0.01%) ⬇️
web-api 89.10% <100.00%> (-0.01%) ⬇️
webhook 89.10% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@WilliamBergamin WilliamBergamin self-assigned this Jul 23, 2026
@WilliamBergamin WilliamBergamin added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch pkg:webhook applies to `@slack/webhook` labels Jul 23, 2026
@WilliamBergamin
WilliamBergamin requested a review from zimeg July 23, 2026 17:27
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review July 23, 2026 17:27
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner July 23, 2026 17:27
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:webhook applies to `@slack/webhook` semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@slack/webhook v8 WebhookTrigger.send() retries after a successful delivery → duplicate Workflow Builder runs + multi-minute hang

1 participant