From 92a3b70f53d924b57fa7ef11bd1d0f963a37c551 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Sun, 18 Aug 2024 00:21:13 -0700 Subject: [PATCH] web-api(feat): include an experimental option for the axios adapter note: a few steps have to happen to use this and it should be with caution! these are experimental changes and not stable. For #2212. this adds clientOptions.experimentalAxiosAdapter to App which accepts combinations of ['xhr', 'http', 'fetch'] and uses that a the default. testing setup: - git clone https://github.com/slackapi/node-slack-sdk - cd node-slack-sdk - git checkout web-api-6.x-experimental-axios-adapter - cd packages/web-api - npm install - npm run build - cd ../../../ - git clone https://github.com/slackapi/bolt-js - cd bolt-js - git checkout web-api-6.x-experimental-axios-adapter - npm install ../node-slack-sdk/packages/web-api - npm run build - cd ../path/to/app - npm install ../path/to/bolt-js - node app.js --- src/App.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/App.ts b/src/App.ts index 184063f81..87c570de9 100644 --- a/src/App.ts +++ b/src/App.ts @@ -104,7 +104,7 @@ export interface AppOptions { logger?: Logger; logLevel?: LogLevel; ignoreSelf?: boolean; - clientOptions?: Pick; + clientOptions?: Pick; socketMode?: boolean; developerMode?: boolean; tokenVerificationEnabled?: boolean; @@ -363,6 +363,7 @@ export default class App this.axios = axios.create({ httpAgent: agent, httpsAgent: agent, + adapter: clientOptions?.experimentalAxiosAdapter ?? ['xhr', 'http', 'fetch'], // disabling axios' automatic proxy support: // axios would read from env vars to configure a proxy automatically, but it doesn't support TLS destinations. // for compatibility with https://api.slack.com, and for a larger set of possible proxies (SOCKS or other