You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "PuszekSE (via GitHub)" <gi...@apache.org> on 2024/07/04 00:08:54 UTC
[I] Slack Notification - deprecated API [superset]
PuszekSE opened a new issue, #29480:
URL: https://github.com/apache/superset/issues/29480
### Bug description
When attempting to send the notification it seems to be failing due to Slack API deprecation:
```
[2024-07-03 04:13:16,531: WARNING/ForkPoolWorker-16] SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'method_deprecated'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)
header_data in notifications for alerts and reports {'notification_type': 'Alert', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 1, 'owners': [...]}, taskid, 52c32a04-bce5-45a9-9add-511c252908fa
[2024-07-03 04:13:16,579: INFO/ForkPoolWorker-16] header_data in notifications for alerts and reports {'notification_type': 'Alert', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 1, 'owners': [...]}, taskid, 52c32a04-bce5-45a9-9add-511c252908fa
SupersetError(message='[Errno 111] Connection refused', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
[2024-07-03 04:13:16,581: WARNING/ForkPoolWorker-16] SupersetError(message='[Errno 111] Connection refused', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
A downstream warning occurred while generating a report: 52c32a04-bce5-45a9-9add-511c252908fa. [SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'method_deprecated'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)]
Traceback (most recent call last):
File "/app/superset/tasks/scheduler.py", line 90, in execute
AsyncExecuteReportScheduleCommand(
File "/app/superset/commands/report/execute.py", line 721, in run
raise ex
File "/app/superset/commands/report/execute.py", line 717, in run
ReportScheduleStateMachine(
File "/app/superset/commands/report/execute.py", line 678, in run
state_cls(
File "/app/superset/commands/report/execute.py", line 582, in next
raise first_ex
File "/app/superset/commands/report/execute.py", line 551, in next
self.send()
File "/app/superset/commands/report/execute.py", line 451, in send
self._send(notification_content, self._report_schedule.recipients)
File "/app/superset/commands/report/execute.py", line 442, in _send
raise ReportScheduleClientErrorsException(errors=notification_errors)
superset.commands.report.exceptions.ReportScheduleClientErrorsException: [SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'method_deprecated'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)]
```
### How to reproduce the bug
1. Setup notification via Slack using SLACK_TOKEN_API
2. Send dashboard as a notification to the channel
### Screenshots/recordings
<img width="466" alt="image" src="https://github.com/apache/superset/assets/4567127/1e7a1e4e-43d7-42f1-8b29-50a81340ab37">
<img width="461" alt="image" src="https://github.com/apache/superset/assets/4567127/358a7620-7975-4ad6-823f-332f77a7ebfc">
<img width="255" alt="image" src="https://github.com/apache/superset/assets/4567127/eb10f2e2-cd92-426e-8111-dac00ddf6916">
### Superset version
master / latest-dev
### Python version
Not applicable
### Node version
Not applicable
### Browser
Not applicable
### Additional context
It's k8s based deployment based on 4.0.2rc-dev image if that matters anyhow.
### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "PuszekSE (via GitHub)" <gi...@apache.org>.
PuszekSE commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2252082445
https://github.com/apache/superset/pull/29264
https://github.com/apache/superset/pull/29264
I believe those were related PRs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho closed issue #29480: Slack Notification - deprecated API
URL: https://github.com/apache/superset/issues/29480
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2207685012
<!-- Greeting -->
Hey there, @PuszekSE! I'm here to help you with any bugs, questions, or contributions you have. Let's work together to resolve this issue.
<!-- Answer -->
To resolve the issue of sending notifications via Slack failing due to a deprecated Slack API method in your Superset deployment, you should update your Slack app to use the new API methods. Specifically, you should replace the deprecated `files_upload` method with the new `files_upload_v2` method.
Here is the relevant part of the code that shows the use of the new method:
```python
# files_upload returns SlackResponse as we run it in sync mode.
for channel in channels:
if len(files) > 0:
for file in files:
client.files_upload_v2(
channel=channel,
file=file,
initial_comment=body,
title=title,
)
else:
client.chat_postMessage(channel=channel, text=body)
```
Ensure that your Slack app has the necessary permissions and scopes to use the new API methods. If the new method fails, the code falls back to the deprecated method, but this should be avoided by updating your Slack app configuration <sup>[[1]](https://github.com/apache/superset/blob/master/superset/reports/notifications/slack.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2259129340
Correct, the above two prs will fix this issue. There's one outstanding issue to be merged to fix the backend runtime migrations: https://github.com/apache/superset/pull/29721
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "VedantBopardikar (via GitHub)" <gi...@apache.org>.
VedantBopardikar commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2212981303
changing the function in superset/reports/notifications/slack.py. from files_upload to files_upload_v2 worked for me. Also the recipients in superset for slack should be channel IDs and not usernames.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "VedantBopardikar (via GitHub)" <gi...@apache.org>.
VedantBopardikar commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2211708146
Where can i find this code to replace it in superset files?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "Chethanibms (via GitHub)" <gi...@apache.org>.
Chethanibms commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2507271565
With reference to the link https://github.com/apache/superset/issues/29480#issuecomment-2207685012
where do we need to change the slack `files_upload_v2` in my helm chart
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2574177992
<!-- Answer -->
To resolve the error related to the deprecated Slack API method, you need to update the Superset codebase, not the Helm chart itself. Specifically, you should modify the `superset/reports/notifications/slack.py` file to replace the deprecated `files_upload` method with the `files_upload_v2` method.
Here's a brief guide on how to do this:
1. **Locate the File**: Access the `superset/reports/notifications/slack.py` file in your Superset deployment.
2. **Modify the Code**: Replace the usage of `files_upload` with `files_upload_v2`. Here's the code snippet you need to update:
```python
for channel in channels:
if len(files) > 0:
for file in files:
client.files_upload_v2(
channel=channel,
file=file,
initial_comment=body,
title=title,
)
else:
client.chat_postMessage(channel=channel, text=body)
```
3. **Deploy the Changes**: After making the changes, you need to redeploy your Superset application. If you're using a Helm chart, this typically involves building a new Docker image with your changes and updating your Helm deployment to use this new image.
4. **Ensure Permissions**: Make sure your Slack app has the necessary permissions and scopes to use the `files_upload_v2` method.
This change should resolve the error you're encountering with the deprecated Slack API method.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/cbc32365-c094-490d-af6a-59d1fe6cc581?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "Chethanibms (via GitHub)" <gi...@apache.org>.
Chethanibms commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2507289619
@dosu getting error
```
superset.commands.report.exceptions.ReportScheduleClientErrorsException: [SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'method_deprecated'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)]
```
where do i need to change the `files_upload_v2` in my helm chart
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2574176562
If you are running Superset 4.1 or later you will be using the Slack v2 api if your Slack app has the correct scopes. Your logs will say which scopes you need to add if they are missing. You will also need to set this flag to true: `ALERT_REPORT_SLACK_V2`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2212321384
I think this has recently been patched on master. @eschutho would know the most here, I think.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "PuszekSE (via GitHub)" <gi...@apache.org>.
PuszekSE commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2212667225
I've checked this on 4.0.2-dev, 1-2 days after its release (although that isn't an option present on the version dropdown list).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Slack Notification - deprecated API [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29480:
URL: https://github.com/apache/superset/issues/29480#issuecomment-2507272909
<!-- Answer -->
The Slack notification code in the Superset codebase is located at `superset/reports/notifications/slack.py` <sup>[[1]](https://github.com/apache/superset/blob/master/superset/reports/notifications/slack.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org