Skip to content

Commit

Permalink
web-api(feat): include an experimental option for the axios adapter
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zimeg committed Aug 18, 2024
1 parent 528ea4f commit 92a3b70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface AppOptions {
logger?: Logger;
logLevel?: LogLevel;
ignoreSelf?: boolean;
clientOptions?: Pick<WebClientOptions, 'slackApiUrl'>;
clientOptions?: Pick<WebClientOptions, 'slackApiUrl' | 'experimentalAxiosAdapter'>;
socketMode?: boolean;
developerMode?: boolean;
tokenVerificationEnabled?: boolean;
Expand Down Expand Up @@ -363,6 +363,7 @@ export default class App<AppCustomContext extends StringIndexed = StringIndexed>
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
Expand Down

0 comments on commit 92a3b70

Please sign in to comment.