You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "bebosudo (via GitHub)" <gi...@apache.org> on 2023/08/18 14:04:47 UTC

[GitHub] [superset] bebosudo opened a new issue, #25026: Report delivery to Slack channel fails with not_in_channel error: docs not up-to-date?

bebosudo opened a new issue, #25026:
URL: https://github.com/apache/superset/issues/25026

   I configured email alerts and those work fine; I'm now trying to setup Slack alerts for superset, following [the instructions in the docs](https://superset.apache.org/docs/installation/alerts-reports/), trying to send an alert to a Slack channel `superset-stage-alerts`.
   
   #### How to reproduce the bug
   
   Here's the Alert configuration:
   ![image](https://github.com/apache/superset/assets/1922124/1d9da8c4-a102-4049-a06f-b4621214d701)
   
   And here's where I added the App to the channel:
   ![image](https://github.com/apache/superset/assets/1922124/e2bbd19f-1a24-42db-8f24-fec1f9d38458)
   
   The scopes of the app were set to the required values (`incoming-webhook`, `files:write`, `chat:write`), and the `SLACK_API_TOKEN` in the config.py file was set.
   The rest of the Superset config (browser installed for screenshots by using the -dev image, worker enabled, etc) should be ok, since I can receive alerts via email just fine.
   
   ### Expected results
   
   Receive message on slack.
   
   ### Actual results
   
   No message was received.
   
   Here are the logs of `superset-worker` when the alert is triggered:
   
   <details>
   <summary>superset-worker logs</summary>
   
   ```log
   Scheduling alert Alberto test slack eta: 2023-08-18 10:30:00
   [2023-08-18 10:30:00,206: INFO/ForkPoolWorker-1] Scheduling alert Alberto test slack eta: 2023-08-18 10:30:00
   Executing alert/report, task id: 7a20c198-5aff-42e5-a6de-a3bee731da7e, scheduled_dttm: 2023-08-18T10:30:00
   [2023-08-18 10:30:00,226: INFO/ForkPoolWorker-1] Executing alert/report, task id: 7a20c198-5aff-42e5-a6de-a3bee731da7e, scheduled_dttm: 2023-08-18T10:30:00
   session is validated: id 4, executionid: 7a20c198-5aff-42e5-a6de-a3bee731da7e
   [2023-08-18 10:30:00,227: INFO/ForkPoolWorker-1] session is validated: id 4, executionid: 7a20c198-5aff-42e5-a6de-a3bee731da7e
   Running report schedule 7a20c198-5aff-42e5-a6de-a3bee731da7e as user admin
   [2023-08-18 10:30:00,296: INFO/ForkPoolWorker-1] Running report schedule 7a20c198-5aff-42e5-a6de-a3bee731da7e as user admin
   Query for Alberto test slack took 981.35 ms
   [2023-08-18 10:30:01,555: INFO/ForkPoolWorker-1] Query for Alberto test slack took 981.35 ms
   Init selenium driver
   [2023-08-18 10:30:01,725: INFO/ForkPoolWorker-1] Init selenium driver
   Taking a PNG screenshot of url http://superset:80/superset/dashboard/3/?force=false&standalone=3 as user admin
   [2023-08-18 10:30:21,098: INFO/ForkPoolWorker-1] Taking a PNG screenshot of url http://superset:80/superset/dashboard/3/?force=false&standalone=3 as user admin
   
   SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'not_in_channel'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)
   [2023-08-18 10:30:22,537: WARNING/ForkPoolWorker-1] SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'not_in_channel'}", 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': 3, 'owners': [Alberto Chiusole]}, taskid, 7a20c198-5aff-42e5-a6de-a3bee731da7e
   [2023-08-18 10:30:22,665: INFO/ForkPoolWorker-1] header_data in notifications for alerts and reports {'notification_type': 'Alert', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 3, 'owners': [Alberto Chiusole]}, taskid, 7a20c198-5aff-42e5-a6de-a3bee731da7e
   Report sent to email, notification content is None
   [2023-08-18 10:30:23,188: INFO/ForkPoolWorker-1] Report sent to email, notification content is None
   A downstream warning occurred while generating a report: 7a20c198-5aff-42e5-a6de-a3bee731da7e. [SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'not_in_channel'}", 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 87, in execute
       AsyncExecuteReportScheduleCommand(
     File "/app/superset/reports/commands/execute.py", line 719, in run
       raise ex
     File "/app/superset/reports/commands/execute.py", line 715, in run
       ReportScheduleStateMachine(
     File "/app/superset/reports/commands/execute.py", line 673, in run
       state_cls(
     File "/app/superset/reports/commands/execute.py", line 574, in next
       raise first_ex
     File "/app/superset/reports/commands/execute.py", line 543, in next
       self.send()
     File "/app/superset/reports/commands/execute.py", line 441, in send
       self._send(notification_content, self._report_schedule.recipients)
     File "/app/superset/reports/commands/execute.py", line 432, in _send
       raise ReportScheduleClientErrorsException(errors=notification_errors)
   superset.reports.commands.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': 'not_in_channel'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)]
   [2023-08-18 10:30:23,265: WARNING/ForkPoolWorker-1] A downstream warning occurred while generating a report: 7a20c198-5aff-42e5-a6de-a3bee731da7e. [SupersetError(message="The request to the Slack API failed. (url: https://www.slack.com/api/files.upload)\nThe server responded with: {'ok': False, 'error': 'not_in_channel'}", 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 87, in execute
       AsyncExecuteReportScheduleCommand(
     File "/app/superset/reports/commands/execute.py", line 719, in run
       raise ex
     File "/app/superset/reports/commands/execute.py", line 715, in run
       ReportScheduleStateMachine(
     File "/app/superset/reports/commands/execute.py", line 673, in run
       state_cls(
     File "/app/superset/reports/commands/execute.py", line 574, in next
       raise first_ex
     File "/app/superset/reports/commands/execute.py", line 543, in next
       self.send()
     File "/app/superset/reports/commands/execute.py", line 441, in send
       self._send(notification_content, self._report_schedule.recipients)
     File "/app/superset/reports/commands/execute.py", line 432, in _send
       raise ReportScheduleClientErrorsException(errors=notification_errors)
   superset.reports.commands.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': 'not_in_channel'}", error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.WARNING: 'warning'>, extra=None)]
   ```
   </details>
   
   I was able to reproduce the problem with a curl:
   
   ```console
   $ curl -X POST -H 'Authorization: Bearer xoxb-12345-asdfasdfasdf' \                     
         -H 'Content-type: application/json' \
         --data '{"channel":"C04ASDF","text":"This is a test sending a message via curl"}' \
             https://slack.com/api/chat.postMessage
   
   {"ok":false,"error":"not_in_channel","warning":"missing_charset","response_metadata":{"warnings":["missing_charset"]}}
   ```
   
   ### Environment
   
   - standard `2.1.0-dev` image on k8s
   
   ### Checklist
   
   - [X] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [X] I have reproduced the issue with at least the latest released version of superset.
   - [X] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ## Solution
   
   This SO question provided the correct solution: https://stackoverflow.com/questions/60198159/
   It's not enough to "install" the bot in the channel as said in the docs (or rather, there's no point doing that it seems), you need to invite the bot to the channel (either with `/invite @botnamehere` in a message or [by visiting the settings of your channel > Integrations > Add app](https://slack.com/help/articles/201330256-Invite-new-members-to-your-workspace)), then everything works, both with curl and in superset.
   Before inviting the bot, I also tried granting the `chat:write.public` permission as suggested in one of the answers, but that failed with the same error as above.
   
   Let me know if this is expected, otherwise I can create a PR to fix this in the docs.


-- 
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] Report delivery to Slack channel fails with not_in_channel error: docs not up-to-date? [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #25026:
URL: https://github.com/apache/superset/issues/25026#issuecomment-1986287513

   Hi there, and sorry this has gone quiet for so long. We're no longer supporting Superset 2.x or prior, and it's been a while since this thread saw any activity, so I'm closing this as stale. If it is still an issue in Superset 3.x, we can re-open this, or feel free to open a new issue with updated context.
   


-- 
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] Report delivery to Slack channel fails with not_in_channel error: docs not up-to-date? [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #25026: Report delivery to Slack channel fails with not_in_channel error: docs not up-to-date?
URL: https://github.com/apache/superset/issues/25026


-- 
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