You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/01/05 09:30:27 UTC

[GitHub] [superset] OlafKocanda opened a new issue #17933: Slack Report Cannot connect to host www.slack.com:443

OlafKocanda opened a new issue #17933:
URL: https://github.com/apache/superset/issues/17933


   I am trying to implement Superset Reports to Slack. I am running superset version 1.3.2 running in a kubernetes cluster with a redis 6.2.6-alpine3.15. I have followed the superset documentation for creating reports including:
   1) Creating a slack app with the necessary permissions
   ![image](https://user-images.githubusercontent.com/58265203/148190077-abb6684d-93f4-4439-af45-19f5f0fae021.png)
   2) Created a channel and connected the Token to the workspace
   3) Added the Token to the superset_config.yaml 
   4) Created a report with the slack channel
   ![image](https://user-images.githubusercontent.com/58265203/148190532-29c2c9af-cf77-4ade-9a63-d04250204c34.png)
   5) Adding all other necessary options to the superset_config.yaml 
   
   #### How to reproduce the bug
   
   My superset-config looks like this:
   ```
   import os
   from cachelib.redis import RedisCache
   from celery.schedules import crontab
   
   class CeleryConfig(object):
       BROKER_URL = f"redis://default:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
       CELERY_IMPORTS = ('superset.sql_lab','superset.tasks', )
       CELERY_RESULT_BACKEND = f"redis://default:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
       CELERYD_PREFETCH_MULTIPLIER = 10
       CELERY_ACKS_LATE = True
       CELERY_TASK_PROTOCOL = 1
       CELERY_LOG_LEVEL = 'DEBUG'
       CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'},
                             'sql_lab.get_sql_results': {'rate_limit': '100/s',},
                             'email_reports.send': {
                             'rate_limit': '1/s',
                             'time_limit': 600,
                             'soft_time_limit': 600,
                             'ignore_result': True,},
                             }
       CELERYBEAT_SCHEDULE = {
         'email_reports.schedule_hourly': {
             'task': 'email_reports.schedule_hourly',
             'schedule': crontab(minute=1, hour='*'),
         },
         'alerts.schedule_check': {
             'task': 'alerts.schedule_check',
             'schedule': crontab(minute='*', hour='*'),
         },
         'reports.scheduler': {
             'task': 'reports.scheduler',
             'schedule': crontab(minute='*', hour='*'),
         },
         'reports.prune_log': {
             'task': 'reports.prune_log',
             'schedule': crontab(minute=0, hour=0),
         },
         'cache-warmup-hourly': {
             'task': 'cache-warmup',
             'schedule': crontab(minute=0, hour='*'), #hourly
              'kwargs': {
                 'strategy_name': 'top_n_dashboards',
                 'top_n': 10,
                 'since': '7 days ago',
             },},}
   
   CELERY_CONFIG = CeleryConfig
   RESULTS_BACKEND = RedisCache(
         host=env('REDIS_HOST'),
         port=env('REDIS_PORT'),
         password=env('REDIS_PASSWORD'),
         key_prefix='superset_results'
   )
   
   #adding email report function
   FEATURE_FLAGS = {
       "ALERT_REPORTS": True,
       "DASHBOARD_NATIVE_FILTERS": True,
       "DASHBOARD_CROSS_FILTERS": True,
       "ENABLE_TEMPLATE_PROCESSING": True,
       "ENABLE_SCHEDULED_EMAIL_REPORTS": True,
       "EMAIL_NOTIFICATIONS": True
   }
   # see: https://superset.apache.org/docs/installation/configuring-superset#sip-15
   SIP_15_ENABLED = True
   
   # If set to true no notification is sent, the worker will just log a message.
   # Useful for debugging
   ALERT_REPORTS_NOTIFICATION_DRY_RUN = False
   
   EMAIL_NOTIFICATIONS = True
   
   SCREENSHOT_LOCATE_WAIT = 100
   SCREENSHOT_LOAD_WAIT = 600
   
   WEBDRIVER_BASEURL = "http://superset.<NAMESPACE>:8088/"
   WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
   
   # Slack configuration
   SLACK_API_TOKEN = "<XXXXTOKEN>"
   ```
   with <NAMESPACE> as my kubernetes namespace
   
   ### Expected results
   
   The report appears in Slack.
   
   ### Actual results
   
   I get the following error log in superset-worker pod:
   ```
   Scheduling alert TEST eta: 2022-01-05 09:12:00
   [2022-01-05 09:12:00,076: INFO/ForkPoolWorker-16] Scheduling alert TEST eta: 2022-01-05 09:12:00
   Screenshotting chart at http://superset.<NAMESPACE>:8088/superset/slice/1/?standalone=true
   [2022-01-05 09:12:00,257: INFO/ForkPoolWorker-15] Screenshotting chart at http://superset.<NAMESPACE>:8088/superset/slice/1/?standalone=true
   Init selenium driver
   [2022-01-05 09:12:00,261: INFO/ForkPoolWorker-15] Init selenium driver
   Taking a PNG screenshot or url http://superset.<NAMESPACE>:8088/superset/slice/1/?standalone=true&standalone=3
   [2022-01-05 09:12:14,656: INFO/ForkPoolWorker-15] Taking a PNG screenshot or url http://superset.<NAMESPACE>:8088/superset/slice/1/?standalone=true&standalone=3
   An unexpected occurred while executing the report: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1001, in _create_direct_connection
       hosts = await asyncio.shield(host_resolved)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 867, in _resolve_host
       addrs = await self._resolver.resolve(host, port, family=self._family)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/resolver.py", line 32, in resolve
       hostname, port, type=socket.SOCK_STREAM, family=family
     File "/usr/local/lib/python3.7/asyncio/base_events.py", line 792, in getaddrinfo
       None, getaddr_func, host, port, family, type, proto, flags)
     File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
       result = self.fn(*self.args, **self.kwargs)
     File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
   socket.gaierror: [Errno -2] Name or service not known
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/app/superset/reports/commands/execute.py", line 579, in run
       session, self._execution_id, self._model, self._scheduled_dttm
     File "/app/superset/reports/commands/execute.py", line 551, in run
       self._execution_id,
     File "/app/superset/reports/commands/execute.py", line 443, in next
       self.send()
     File "/app/superset/reports/commands/execute.py", line 349, in send
       self._send(notification_content, self._report_schedule.recipients)
     File "/app/superset/reports/commands/execute.py", line 335, in _send
       notification.send()
     File "/usr/local/lib/python3.7/site-packages/backoff/_sync.py", line 94, in retry
       ret = target(*args, **kwargs)
     File "/app/superset/reports/notifications/slack.py", line 149, in send
       filetype=file_type,
     File "/usr/local/lib/python3.7/site-packages/slack/web/client.py", line 970, in files_upload
       return self.api_call("files.upload", files={"file": file}, data=kwargs)
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 171, in api_call
       return self._event_loop.run_until_complete(future)
     File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
       return future.result()
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 214, in _send
       http_verb=http_verb, api_url=api_url, req_args=req_args
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 244, in _request
       async with session.request(http_verb, api_url, **req_args) as res:
     File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1124, in __aenter__
       self._resp = await self._coro
     File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 528, in _request
       req, traces=traces, timeout=real_timeout
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 537, in connect
       proto = await self._create_connection(req, traces, timeout)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 894, in _create_connection
       _, proto = await self._create_direct_connection(req, traces, timeout)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1013, in _create_direct_connection
       raise ClientConnectorError(req.connection_key, exc) from exc
   aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/app/superset/tasks/scheduler.py", line 71, in execute
       task_id, report_schedule_id, scheduled_dttm_,
     File "/app/superset/reports/commands/execute.py", line 584, in run
       raise ReportScheduleUnexpectedError(str(ex))
   superset.reports.commands.exceptions.ReportScheduleUnexpectedError: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   [2022-01-05 09:12:15,282: ERROR/ForkPoolWorker-15] An unexpected occurred while executing the report: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1001, in _create_direct_connection
       hosts = await asyncio.shield(host_resolved)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 867, in _resolve_host
       addrs = await self._resolver.resolve(host, port, family=self._family)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/resolver.py", line 32, in resolve
       hostname, port, type=socket.SOCK_STREAM, family=family
     File "/usr/local/lib/python3.7/asyncio/base_events.py", line 792, in getaddrinfo
       None, getaddr_func, host, port, family, type, proto, flags)
     File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
       result = self.fn(*self.args, **self.kwargs)
     File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
   socket.gaierror: [Errno -2] Name or service not known
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/app/superset/reports/commands/execute.py", line 579, in run
       session, self._execution_id, self._model, self._scheduled_dttm
     File "/app/superset/reports/commands/execute.py", line 551, in run
       self._execution_id,
     File "/app/superset/reports/commands/execute.py", line 443, in next
       self.send()
     File "/app/superset/reports/commands/execute.py", line 349, in send
       self._send(notification_content, self._report_schedule.recipients)
     File "/app/superset/reports/commands/execute.py", line 335, in _send
       notification.send()
     File "/usr/local/lib/python3.7/site-packages/backoff/_sync.py", line 94, in retry
       ret = target(*args, **kwargs)
     File "/app/superset/reports/notifications/slack.py", line 149, in send
       filetype=file_type,
     File "/usr/local/lib/python3.7/site-packages/slack/web/client.py", line 970, in files_upload
       return self.api_call("files.upload", files={"file": file}, data=kwargs)
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 171, in api_call
       return self._event_loop.run_until_complete(future)
     File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
       return future.result()
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 214, in _send
       http_verb=http_verb, api_url=api_url, req_args=req_args
     File "/usr/local/lib/python3.7/site-packages/slack/web/base_client.py", line 244, in _request
       async with session.request(http_verb, api_url, **req_args) as res:
     File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1124, in __aenter__
       self._resp = await self._coro
     File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 528, in _request
       req, traces=traces, timeout=real_timeout
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 537, in connect
       proto = await self._create_connection(req, traces, timeout)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 894, in _create_connection
       _, proto = await self._create_direct_connection(req, traces, timeout)
     File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1013, in _create_direct_connection
       raise ClientConnectorError(req.connection_key, exc) from exc
   aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/app/superset/tasks/scheduler.py", line 71, in execute
       task_id, report_schedule_id, scheduled_dttm_,
     File "/app/superset/reports/commands/execute.py", line 584, in run
       raise ReportScheduleUnexpectedError(str(ex))
   superset.reports.commands.exceptions.ReportScheduleUnexpectedError: Cannot connect to host www.slack.com:443 ssl:default [Name or service not known]
   
   ```
   
   The superset-celerybeat or redis-master logs are not having any additional output. 
   
   #### Screenshots
   
   The Report log is not helpful at all:
   ![image](https://user-images.githubusercontent.com/58265203/148191937-518ef0fb-c068-4d11-b2c1-c44293990ba6.png)
   
   ### Environment
   
   - browser type and version: Firefox 95.0.2 (64-bit)
   - superset version: `1.3.2`
   - python version: `Python 3.7.9`
   - node.js version: N/A
   - any feature flags active:
   ```
   FEATURE_FLAGS = {
       "ALERT_REPORTS": True,
       "DASHBOARD_NATIVE_FILTERS": True,
       "DASHBOARD_CROSS_FILTERS": True,
       "ENABLE_TEMPLATE_PROCESSING": True,
       "ENABLE_SCHEDULED_EMAIL_REPORTS": True,
       "EMAIL_NOTIFICATIONS": True
   }
   ```
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [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.
   


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