superset icon indicating copy to clipboard operation
superset copied to clipboard

Slack API `files.upload` v1 deprecation

Open asaf400 opened this issue 3 months ago • 3 comments

Bug description

The API superset uses for slack reports has been deprecated, and needs to be replaced with the new API:

As described here files.upload is deprecated and will stop functioning on March 11, 2025. Use [files.getUploadURLExternal](https://api.slack.com/methods/files.getUploadURLExternal) and [files.completeUploadExternal](https://api.slack.com/methods/files.completeUploadExternal) to upload files instead. Newly created apps will be unable to use files.upload beginning May 8, 2024. See [Uploading files](https://api.slack.com/messaging/files#uploading_files) for more details on the process and [this changelog](https://api.slack.com/changelog/2024-04-a-better-way-to-upload-files-is-here-to-stay) for more on the deprecation.

Seems like new slack-sdk version required minimum is v3.19.0 Which Superset already uses https://github.com/apache/superset/blob/f5843fe588112c5c303215945a36fda0845c9e99/pyproject.toml#L88

[root@LAPTOP-ASAF-T14 ~]# pip install 'slack_sdk>=3.19.0, <4'
Collecting slack_sdk<4,>=3.19.0
...
Installing collected packages: slack_sdk
Successfully installed slack_sdk-3.27.1

additional resources: https://github.com/slackapi/python-slack-sdk/pull/1272

How to reproduce the bug

Deprecation

Screenshots/recordings

As a slack organization administrator I received the following message by email:

2024-05-06 12_40_45-Gmail - Upcoming changes to support for the files upload API method - asaf levy@

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

asaf400 avatar May 06 '24 09:05 asaf400

I'm guessing in the meantime it might be a good idea updating the docs: https://github.com/apache/superset/blob/master/docs/docs/configuration/alerts-reports.mdx#slack-integration

Because if slack are true to their word, New superset deployment cannot create the slack integration (assuming operator creates new app in slack console..)

asaf400 avatar May 08 '24 16:05 asaf400

Updating the Apache Superset documentation to reflect the Slack API changes is indeed a crucial step. The deprecation of files.upload necessitates a shift to files.getUploadURLExternal and files.completeUploadExternal for file uploads. This change should be clearly documented to guide new Superset deployments in setting up Slack integrations correctly.

For the codebase, transitioning involves:

  1. Replacing files.upload with files.getUploadURLExternal to obtain an upload URL.
  2. Uploading the file to this URL, then calling files.completeUploadExternal to finalize the upload.

This process requires adjustments in error handling and response validation to align with the new Slack API methods. It's essential to ensure the Slack SDK version is compatible and to update any relevant configuration settings in Superset.

Contributors can update the documentation by:

  1. Setting up a local development environment and making changes in the ./docs directory.
  2. Building and serving a production build of the documentation site for verification.
  3. Submitting pull requests with the docs: prefix to propose changes.

For testing changes to the Slack integration, unit tests with mock objects can verify the functionality without actual Slack API interaction. This approach ensures the integration works as expected under controlled conditions.

Finally, notifying Superset users about these important changes involves updating CHANGELOG.md and UPDATING.md, utilizing community channels like Slack for announcements, and encouraging regular review of the documentation for updates. GitHub can also be used to track issues and updates related to these changes.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 08 '24 19:05 dosubot[bot]

https://github.com/apache/superset/pull/28423 should do it, not sure how to test/validate though

mistercrunch avatar May 10 '24 03:05 mistercrunch