chore: provide proxied configurations in update to "@slack/web-api@v8" and "@slack/webhook@v8" packages#619
chore: provide proxied configurations in update to "@slack/web-api@v8" and "@slack/webhook@v8" packages#619zimeg wants to merge 22 commits into
Conversation
Migrate from axios/https-proxy-agent to native fetch with undici ProxyAgent, supporting the @slack/web-api v8 release candidate (slackapi/node-slack-sdk#2603). Breaking changes addressed: - Replace `agent` option with `fetch` option for WebClient proxy support - Replace axios with native fetch + undici ProxyAgent for webhook requests - Replace axios-retry with built-in retry logic for webhook requests - Update error handling to use v8 Error subclasses Dependencies removed: axios, axios-retry, https-proxy-agent Dependencies added: undici (for ProxyAgent) Dependencies upgraded: @slack/web-api ^7 → ^8.0.0-rc.1, @slack/logger ^4 → ^5.0.0-rc.1 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
🦋 Changeset detectedLatest commit: ccbeecd 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 |
Cast ProxyAgent to `any` to avoid type mismatch between undici's Dispatcher and undici-types' Dispatcher in Node's fetch signature. Initialize userAgent property to satisfy strict property checks. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #619 +/- ##
==========================================
- Coverage 99.86% 99.86% -0.01%
==========================================
Files 7 8 +1
Lines 730 725 -5
==========================================
- Hits 729 724 -5
Misses 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tests must explicitly configure mocks.fetch for their specific scenario rather than relying on a hidden default response. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
🪄 A comment about webhook implementations while we explore changes-
Replace the manual fetch-with-retry implementation with IncomingWebhook from @slack/webhook v8 RC. The SDK handles HTTP internally while we inject a custom fetch wrapper for User-Agent and proxy support. Note: @slack/webhook v8 does not export addAppMetadata, so there is no public way to register custom app metadata in the SDK's User-Agent. We supplement by prepending our action identity in the custom fetch wrapper. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use @slack/webhook IncomingWebhook only for the incoming-webhook type. Webhook triggers use a direct fetch since the SDK has no class for them and the response shape differs (JSON vs plain text). Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
# Conflicts: # package-lock.json
|
[DRAFT — do not submit yet] Why the
Ruled out the alternatives:
Maintenance note: the override is a literal |
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Now that @slack/web-api 8.0.0, @slack/webhook 8.0.0, and @slack/logger 5.0.0 are stable on the latest dist-tag, drop the -rc pins and refresh the lockfile (@slack/types also resolves to stable 3.0.0).
undici-types releases in lockstep with undici but reaches the tree via @types/node, so it is pinned through an overrides entry. Grouping the two keeps the runtime dep and its override bumped together in a single PR rather than drifting across separate ones.
Summary
This pull request upgrades to the
@slack/web-apiand@slack/webhookv8 release candidates (slackapi/node-slack-sdk#2603), maintaining full proxy support by migrating from axios/https-proxy-agent to nativefetchwith the undiciProxyAgent.Changes:
@slack/web-apiv8WebClient, using itsfetchoption instead of the removedagentoption@slack/webhookv8IncomingWebhookandWebhookTriggerclients, using theirfetchoption andretryConfigretry policiesproxiedFetchfactory (src/proxies.js) that returns a customfetchbacked by an undiciProxyAgentdispatcher — injected into both the API and webhook clients so proxying stays opt-in and testable without any global dispatcher stateaddAppMetadataexports (rc.2 restoresaddAppMetadata,WebhookTrigger, andretryPolicies), so the SDK sets theUser-AgentinternallyErrorsubclasses (WebAPIPlatformError,WebAPIHTTPError, etc.)Dependencies removed:
axios,axios-retry,https-proxy-agentDependencies added:
undici(forProxyAgent)Dependencies upgraded:
@slack/web-api^7 → ^8.0.0-rc.2,@slack/webhook^7 → ^8.0.0-rc.2,@slack/logger^4 → ^5.0.0-rc.1The
proxyinput andHTTPS_PROXYenvironment variable continue to work unchanged for end users.Requirements