Skip to content

feat: upgrade to @slack/web-api v8 with proxy support via undici#619

Draft
zimeg wants to merge 5 commits into
mainfrom
support-web-api-v8
Draft

feat: upgrade to @slack/web-api v8 with proxy support via undici#619
zimeg wants to merge 5 commits into
mainfrom
support-web-api-v8

Conversation

@zimeg
Copy link
Copy Markdown
Member

@zimeg zimeg commented Jun 1, 2026

Summary

This pull request upgrades to @slack/web-api v8 release candidate (slackapi/node-slack-sdk#2603), maintaining full proxy support by migrating from axios/https-proxy-agent to native fetch with undici ProxyAgent.

Changes:

  • Replace agent WebClient option with fetch option using undici ProxyAgent for proxy routing
  • Replace axios/axios-retry with native fetch + built-in retry logic for webhook requests
  • Replace https-proxy-agent with undici ProxyAgent for both API method and webhook proxy support
  • Update error handling to use v8 Error subclasses (WebAPIPlatformError, WebAPIHTTPError, etc.)
  • Add injectable config.fetch for testability (same pattern as the previous config.axios)

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

The proxy input and HTTPS_PROXY environment variable continue to work unchanged for end users.

Requirements

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-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

⚠️ No Changeset found

Latest commit: 6bfc793

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.85%. Comparing base (9a2e0ee) to head (a530598).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
- Coverage   99.86%   99.85%   -0.01%     
==========================================
  Files           7        7              
  Lines         736      710      -26     
==========================================
- Hits          735      709      -26     
  Misses          1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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>
Copy link
Copy Markdown
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

🪄 A comment about webhook implementations while we explore changes-

Comment thread src/webhook.js Outdated
Comment on lines 20 to 32
const response = await this.fetchWithRetry(
config.inputs.webhook,
config.content.values,
{
...this.proxies(config),
method: "POST",
headers: {
"Content-Type": "application/json",
"User-Agent": config.userAgent,
},
body: JSON.stringify(config.content.values),
},
retryConfig,
fetchFn,
);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🔮 thought: At a glance this adds code that might be handled with @slack/webhook better?

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>
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.

1 participant