Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @slack/bolt to use slack/web-api v7 for compatibility #1733

Closed
mister-good-deal opened this issue Jan 20, 2024 · 2 comments
Closed

Update @slack/bolt to use slack/web-api v7 for compatibility #1733

mister-good-deal opened this issue Jan 20, 2024 · 2 comments
Labels
question M-T: User needs support to use the project

Comments

@mister-good-deal
Copy link

mister-good-deal commented Jan 20, 2024

After updating @slack/web-api from v6 to v7, some imported type in TS were not sync anymore between @slack/bolt module and @slack/web-api module.

Example :

import type { WebClient } from "@slack/web-api";

must become

import type { WebClient } from "@slack/bolt/node_modules/@slack/web-api";

because the last version of @slack/bolt is using @slack/web-api v6 so the app failed to build.

Error was the following:

src/listeners/messages/bot-message.ts:43:79 - error TS2345: Argument of type 'import("/home/rom1/Projects/ai-project-team/slack/node_modules/@slack/bolt/node_modules/@slack/web-api/dist/WebClient").WebClient' is not assignable to parameter of type 'import("/home/rom1/Projects/ai-project-team/slack/node_modules/@slack/web-api/dist/WebClient").WebClient'.
  Property 'functions' is missing in type 'import("/home/rom1/Projects/ai-project-team/slack/node_modules/@slack/bolt/node_modules/@slack/web-api/dist/WebClient").WebClient' but required in type 'import("/home/rom1/Projects/ai-project-team/slack/node_modules/@slack/web-api/dist/WebClient").WebClient'.

43         if (!threadId) updateChannelPurposeWithThreadId(purpose, thread!.id!, client, genericMessage.channel);
                                                                                 ~~~~~~

  node_modules/@slack/web-api/dist/methods.d.ts:1008:14
    1008     readonly functions: {
                      ~~~~~~~~~
    'functions' is declared here.

In node_modules/@slack/bolt/dist/types/middleware.d.ts, WebClient is defined as import { WebClient } from '@slack/web-api';

@filmaj filmaj added question M-T: User needs support to use the project needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info and removed untriaged needs info An issue that is claimed to be a bug and hasn't been reproduced, or otherwise needs more info labels Jan 20, 2024
@filmaj
Copy link
Contributor

filmaj commented Jan 20, 2024

Yes, in bolt we intentionally are keeping web-api to v6 within the bolt v3 line as web-api v7 is a breaking change. Updating web-api within bolt to v7 will necessitate a new major release of bolt. We are planning on doing this, but it will take a bit more time as there are other packages that bolt relies on (like @slack/socket-mode) that will also include breaking changes (though I am working on that as well; see #1732).

Ultimately your specific error here is dependent on how you import and use the types from web-api vs. bolt.

If you want to use BOTH bolt v3.x (with bundled web-api v6) AND web-api v7 at the same time, it will take delicate care, knowing that the two major versions of web-api are incompatible and which client is used in which situation.

@filmaj
Copy link
Contributor

filmaj commented Jan 26, 2024

Going to close this as eventually this will land in bolt (plus this is not the bolt repo).

@filmaj filmaj closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants