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

Migration to web‐api v7 - Unexpected token argument in apps.uninstall method #1871

Closed
1 of 7 tasks
tristan-s opened this issue Aug 14, 2024 · 2 comments · Fixed by #1872
Closed
1 of 7 tasks

Migration to web‐api v7 - Unexpected token argument in apps.uninstall method #1871

tristan-s opened this issue Aug 14, 2024 · 2 comments · Fixed by #1872
Labels
area:typescript issues that specifically impact using the package from typescript projects bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:web-api applies to `@slack/web-api` semver:patch

Comments

@tristan-s
Copy link

We are transitioning our application using the v6 of the @slack/web-api package to the v7. One breaking change is detected by the compiler, related to the apps.uninstall method.

Previously, our wrapper defined the uninstall methods like this:

async uninstallApplication() {
    const accessToken = await this.accessTokenFetcher.getAccessToken();

    const { error } = await this.slackClient.apps.uninstall({
        token: accessToken,
        client_id: _credentials.slack.clientId,
        client_secret: _credentials.slack.clientSecret
    });
    if (error) { throw new SlackResponseError(error); }
}

Now, we get an error on the token parameter of that method, which suggests that the token field is not expected by the apps.uninstall method:

Vue: Object literal may only specify known properties, and token does not exist in type
Pick<OAuthCredentials, "client_id" | "client_secret">

We've checked the doc for apps.uninstall, and token is still listed as a required argument.

Is the documentation outdated? Or are we misusing the apps.uninstall method?

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know

Reproducible in:

The Slack SDK version

7.3.2

Node.js runtime version

v20.15.1

OS info

ProductName: macOS
ProductVersion: 14.5
BuildVersion: 23F79
Darwin Kernel Version 23.5.0: Wed May 1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030

Steps to reproduce:

  1. Update to the version 7.3.2 of the web-api package
  2. Try to call slackClient.apps.uninstall with a token argument

Expected result:

  • Either the documentation and the code both say we don't need a token argument;
  • Or we don't get an error

Actual result:

image

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

@zimeg zimeg added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch area:typescript issues that specifically impact using the package from typescript projects pkg:web-api applies to `@slack/web-api` and removed untriaged labels Aug 14, 2024
@zimeg
Copy link
Member

zimeg commented Aug 14, 2024

Hey @tristan-s 👋 Thanks for raising this - I can confirm this causes error! It does seem unexpected and I'm noticing both the apps.uninstall and admin.apps.uninstall methods are missing this token override too...

I think both of these methods should offer the token attribute for the exact case you're outlining, so I'll get started on a fix 👀

As a quick workaround I'd suggest using .apiCall('apps.uninstall', { ... }) from the using a dynamic method name section to avoid type-checking if this is blocking you right now!

@zimeg zimeg added this to the [email protected] milestone Aug 14, 2024
zimeg added a commit to zimeg/node-slack-sdk that referenced this issue Aug 14, 2024
Fixes slackapi#1871 with a few other methods:

- admins.apps.clearResolution
- admin.apps.uninstall
- apps.uninstall
@zimeg
Copy link
Member

zimeg commented Aug 14, 2024

@tristan-s thanks again for sharing this! A fix should now be available in @slack/[email protected]! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typescript issues that specifically impact using the package from typescript projects bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:web-api applies to `@slack/web-api` semver:patch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants