feat(webhook): add opt-in retries to IncomingWebhook and WebhookTrigger#2641
feat(webhook): add opt-in retries to IncomingWebhook and WebhookTrigger#2641zimeg wants to merge 11 commits into
Conversation
🦋 Changeset detectedLatest commit: 345ff5b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## eden/webhook-trigger #2641 +/- ##
========================================================
+ Coverage 88.96% 89.07% +0.11%
========================================================
Files 64 65 +1
Lines 10375 10455 +80
Branches 464 472 +8
========================================================
+ Hits 9230 9313 +83
+ Misses 1123 1121 -2
+ Partials 22 21 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Default the payload to an empty object so send() can be called with no
arguments, POSTing an empty body. send({}) continues to work unchanged.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…webhook-retries # Conflicts: # packages/webhook/src/WebhookTrigger.ts
The `= {}` default now lives in the WebhookTrigger PR; keep the @param
description unchanged here.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use a falsy check so an empty-string URL is rejected up front rather than failing later at request time. Adds a guard test. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
🔏 More words for the amazing reviewers.
There was a problem hiding this comment.
✂️ note: Matches the @slack/web-api implementation:
| "p-retry": "^4", | ||
| "retry": "^0.13.1" |
There was a problem hiding this comment.
🔍 note: These packages align with the @slack/web-api implementations:
node-slack-sdk/packages/web-api/package.json
Lines 61 to 62 in 12b94a2
| // Strip transport-only options so they do not leak into the posted payload. | ||
| this.defaults.agent = undefined; | ||
| this.defaults.retryConfig = undefined; |
There was a problem hiding this comment.
📝 note: The default options passed to requests isn't ideal practice IMHO but we avoid regressions with this line.
Summary
Adds opt-in retry support to
@slack/webhook, mirroring theretryConfigconvention already used by@slack/web-api'sWebClient. Stacked on top of #2615 (theWebhookTriggerclass), so this PR is scoped to just the retry change.IncomingWebhookandWebhookTriggeraccept a newretryConfig?: RetryOptionsconstructor option.retry-policies.tswith the same named policies exported by@slack/web-api—fiveRetriesInFiveMinutes,tenRetriesInAboutThirtyMinutes,rapidRetryPolicy— re-exported from the package entry point.send()is wrapped inp-retryusing the configured policy.Default: no retries (
{ retries: 0 }) whenretryConfigis unset — preserves today's behavior; retries are opt-in.Retry conditions (transient failures only, matching
@slack/web-api's intent):429) and server errors (5xx) → retry4xx) → abort immediately (won't succeed on retry)retryConfigis a transport-only option and is stripped from the posted payload (likeagent).Consumed downstream by slackapi/slack-github-action#630, which passes its
0/5/10/RAPIDinput through to these policies.Requirements
🤖 Generated with Claude Code