superset
superset copied to clipboard
Slack API `files.upload` v1 deprecation
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:
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.
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..)
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:
- Replacing
files.upload
withfiles.getUploadURLExternal
to obtain an upload URL. - 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:
- Setting up a local development environment and making changes in the
./docs
directory. - Building and serving a production build of the documentation site for verification.
- 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
- Using new slack-sdk file upload method.
- superset/reports/notifications/slack.py
- superset/tasks/slack_util.py
- UPDATING.md
- docs/docs/contributing/howtos.mdx
- tests/unit_tests/notifications/slack_tests.py
- RELEASING/release-notes-4-0/README.md
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.
https://github.com/apache/superset/pull/28423 should do it, not sure how to test/validate though
I think the above fix should cover this issue. Thanks for the report @asaf400!
I've deployed superset using the helm chart. I'm currently using app v3.1.0 and chart v0.12.3 I'm facing the same issue. Do I need to update/change something from my side so that the slack deprecation is fixed? Please help me out. Thanks in advance!
The fix is already in master - merged after v4.0.1, so just wait for the next release build, or locally build master
Just FYI, after switching to file_upload_v2
you won't be able to specify channel name, only it's ID due to https://github.com/slackapi/python-slack-sdk/issues/1326.
The fix is already in master - merged after v4.0.1, so just wait for the next release build, or locally build
master
@asaf400 I just deployed 4.0.2 a few minutes ago and am getting this error still. Did this fix make it into 4.0.2 appropriately? Is there a change to deployment documentation to deploy this fix? A new feature flag, perhaps?
Thanks in advance for your assistance.
CC @michael-s-molina regarding whether or not this was cherried into 4.0.2 (or could be cherried into 4.0.3).
@rusackas This was not included in 4.0.2 but will be in 4.1.0 which will be the next release of Superset @sadpandajoe @eschutho
@rusackas This was not included in 4.0.2 but will be in 4.1.0 which will be the next release of Superset @sadpandajoe @eschutho
The first two attempts to fix the issue wasn't working well. @eschutho created this SIP: https://github.com/apache/superset/issues/29263 and is currently working on it.
@rusackas This was not included in 4.0.2 but will be in 4.1.0 which will be the next release of Superset @sadpandajoe @eschutho
The first two attempts to fix the issue wasn't working well. @eschutho created this SIP: https://github.com/apache/superset/issues/29263 and is currently working on it.
What is the timeframe for this? As far as I can see, slack notifications are completely inoperable at this point unless one builds from source removing the file upload from the message?
@rusackas This was not included in 4.0.2 but will be in 4.1.0 which will be the next release of Superset @sadpandajoe @eschutho
The first two attempts to fix the issue wasn't working well. @eschutho created this SIP: #29263 and is currently working on it.
What is the timeframe for this? As far as I can see, slack notifications are completely inoperable at this point unless one builds from source removing the file upload from the message?
You can follow this PR: https://github.com/apache/superset/pull/29264 to see when it gets merged.