superset: Error Report Failed Taking Screenshot

A clear and concise description of what the bug is. Error on scheduled report : Failed taking a screenshot Message: Argument --marionette can’t be set via capabilities Superset run on docker

How to reproduce the bug

  1. Go to ‘Alerts and Reports’
  2. Create new scheduled reports on dashboard or chart
  3. See error log on superset_app container

Expected results

dashboard screenshot received by email or slack channel

what you expected to happen. dashboard screenshot received by email or slack channel

Actual results

error Failed taking a screenshot Message: Argument --marionette can’t be set via capabilities

header_data in notifications for alerts and reports {'notification_type': 'Report', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 8, 'owners': [Superset Admin]}, taskid, 5033b9ec-b364-4dec-8a8d-f7b2584f101d
[2022-12-04 14:48:01,265: INFO/ForkPoolWorker-1] header_data in notifications for alerts and reports {'notification_type': 'Report', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 8, 'owners': [Superset Admin]}, taskid, 5033b9ec-b364-4dec-8a8d-f7b2584f101d
SupersetError(message='[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
[2022-12-04 14:48:01,284: WARNING/ForkPoolWorker-1] SupersetError(message='[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
A downstream LoggerLevel.EXCEPTION occurred while generating a report: 5033b9ec-b364-4dec-8a8d-f7b2584f101d
Traceback (most recent call last):
  File "/app/superset/reports/commands/execute.py", line 220, in _get_screenshots
    image = screenshot.get_screenshot(user=user)
  File "/app/superset/utils/screenshots.py", line 76, in get_screenshot
    self.screenshot = driver.get_screenshot(self.url, self.element, user)
  File "/app/superset/utils/webdriver.py", line 111, in get_screenshot
    driver = self.auth(user)
  File "/app/superset/utils/webdriver.py", line 89, in auth
    driver = self.create()
  File "/app/superset/utils/webdriver.py", line 86, in create
    return driver_class(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Argument --marionette can't be set via capabilities


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/superset/tasks/scheduler.py", line 87, in execute
    AsyncExecuteReportScheduleCommand(
  File "/app/superset/reports/commands/execute.py", line 706, in run
    raise ex
  File "/app/superset/reports/commands/execute.py", line 702, in run
    ReportScheduleStateMachine(
  File "/app/superset/reports/commands/execute.py", line 664, in run
    state_cls(
  File "/app/superset/reports/commands/execute.py", line 565, in next
    raise first_ex
  File "/app/superset/reports/commands/execute.py", line 534, in next
    self.send()
  File "/app/superset/reports/commands/execute.py", line 431, in send
    notification_content = self._get_notification_content()
  File "/app/superset/reports/commands/execute.py", line 338, in _get_notification_content
    screenshot_data = self._get_screenshots()
  File "/app/superset/reports/commands/execute.py", line 225, in _get_screenshots
    raise ReportScheduleScreenshotFailedError(
superset.reports.commands.exceptions.ReportScheduleScreenshotFailedError: Failed taking a screenshot Message: Argument --marionette can't be set via capabilities

[2022-12-04 14:48:01,305: ERROR/ForkPoolWorker-1] A downstream LoggerLevel.EXCEPTION occurred while generating a report: 5033b9ec-b364-4dec-8a8d-f7b2584f101d
Traceback (most recent call last):
  File "/app/superset/reports/commands/execute.py", line 220, in _get_screenshots
    image = screenshot.get_screenshot(user=user)
  File "/app/superset/utils/screenshots.py", line 76, in get_screenshot
    self.screenshot = driver.get_screenshot(self.url, self.element, user)
  File "/app/superset/utils/webdriver.py", line 111, in get_screenshot
    driver = self.auth(user)
  File "/app/superset/utils/webdriver.py", line 89, in auth
    driver = self.create()
  File "/app/superset/utils/webdriver.py", line 86, in create
    return driver_class(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Argument --marionette can't be set via capabilities


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/superset/tasks/scheduler.py", line 87, in execute
    AsyncExecuteReportScheduleCommand(
  File "/app/superset/reports/commands/execute.py", line 706, in run
    raise ex
  File "/app/superset/reports/commands/execute.py", line 702, in run
    ReportScheduleStateMachine(
  File "/app/superset/reports/commands/execute.py", line 664, in run
    state_cls(
  File "/app/superset/reports/commands/execute.py", line 565, in next
    raise first_ex
  File "/app/superset/reports/commands/execute.py", line 534, in next
    self.send()
  File "/app/superset/reports/commands/execute.py", line 431, in send
    notification_content = self._get_notification_content()
  File "/app/superset/reports/commands/execute.py", line 338, in _get_notification_content
    screenshot_data = self._get_screenshots()
  File "/app/superset/reports/commands/execute.py", line 225, in _get_screenshots
    raise ReportScheduleScreenshotFailedError(
superset.reports.commands.exceptions.ReportScheduleScreenshotFailedError: Failed taking a screenshot Message: Argument --marionette can't be set via capabilities

[2022-12-04 14:48:01,313: INFO/ForkPoolWorker-1] Task reports.execute[5033b9ec-b364-4dec-8a8d-f7b2584f101d] succeeded in 1.2248869069999273s: None
[2022-12-04 14:49:00,011: INFO/MainProcess] Task reports.scheduler[0530a6d8-189c-4fb8-be94-0105a924d158] received
Scheduling alert test eta: 2022-12-04 14:49:00
[2022-12-04 14:49:00,030: INFO/ForkPoolWorker-1] Scheduling alert test eta: 2022-12-04 14:49:00
[2022-12-04 14:49:00,035: INFO/MainProcess] Task reports.execute[9ae6e73c-a46d-4f27-a050-a15b5d6f9da9] received
[2022-12-04 14:49:00,036: INFO/ForkPoolWorker-1] Task reports.scheduler[0530a6d8-189c-4fb8-be94-0105a924d158] succeeded in 0.02262895000012577s: None
Executing alert/report, task id: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9, scheduled_dttm: 2022-12-04T14:49:00
[2022-12-04 14:49:00,038: INFO/ForkPoolWorker-1] Executing alert/report, task id: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9, scheduled_dttm: 2022-12-04T14:49:00
session is validated: id 2, executionid: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
[2022-12-04 14:49:00,039: INFO/ForkPoolWorker-1] session is validated: id 2, executionid: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
Running report schedule 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9 as user admin
[2022-12-04 14:49:00,059: INFO/ForkPoolWorker-1] Running report schedule 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9 as user admin
Init selenium driver
[2022-12-04 14:49:00,103: INFO/ForkPoolWorker-1] Init selenium driver
header_data in notifications for alerts and reports {'notification_type': 'Report', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 8, 'owners': [Superset Admin]}, taskid, 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
[2022-12-04 14:49:01,170: INFO/ForkPoolWorker-1] header_data in notifications for alerts and reports {'notification_type': 'Report', 'notification_source': <ReportSourceFormat.DASHBOARD: 'dashboard'>, 'notification_format': 'PNG', 'chart_id': None, 'dashboard_id': 8, 'owners': [Superset Admin]}, taskid, 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
SupersetError(message='[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
[2022-12-04 14:49:01,183: WARNING/ForkPoolWorker-1] SupersetError(message='[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)', error_type=<SupersetErrorType.REPORT_NOTIFICATION_ERROR: 'REPORT_NOTIFICATION_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra=None)
A downstream LoggerLevel.EXCEPTION occurred while generating a report: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
Traceback (most recent call last):
  File "/app/superset/reports/commands/execute.py", line 220, in _get_screenshots
    image = screenshot.get_screenshot(user=user)
  File "/app/superset/utils/screenshots.py", line 76, in get_screenshot
    self.screenshot = driver.get_screenshot(self.url, self.element, user)
  File "/app/superset/utils/webdriver.py", line 111, in get_screenshot
    driver = self.auth(user)
  File "/app/superset/utils/webdriver.py", line 89, in auth
    driver = self.create()
  File "/app/superset/utils/webdriver.py", line 86, in create
    return driver_class(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Argument --marionette can't be set via capabilities


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/superset/tasks/scheduler.py", line 87, in execute
    AsyncExecuteReportScheduleCommand(
  File "/app/superset/reports/commands/execute.py", line 706, in run
    raise ex
  File "/app/superset/reports/commands/execute.py", line 702, in run
    ReportScheduleStateMachine(
  File "/app/superset/reports/commands/execute.py", line 664, in run
    state_cls(
  File "/app/superset/reports/commands/execute.py", line 565, in next
    raise first_ex
  File "/app/superset/reports/commands/execute.py", line 534, in next
    self.send()
  File "/app/superset/reports/commands/execute.py", line 431, in send
    notification_content = self._get_notification_content()
  File "/app/superset/reports/commands/execute.py", line 338, in _get_notification_content
    screenshot_data = self._get_screenshots()
  File "/app/superset/reports/commands/execute.py", line 225, in _get_screenshots
    raise ReportScheduleScreenshotFailedError(
superset.reports.commands.exceptions.ReportScheduleScreenshotFailedError: Failed taking a screenshot Message: Argument --marionette can't be set via capabilities

[2022-12-04 14:49:01,201: ERROR/ForkPoolWorker-1] A downstream LoggerLevel.EXCEPTION occurred while generating a report: 9ae6e73c-a46d-4f27-a050-a15b5d6f9da9
Traceback (most recent call last):
  File "/app/superset/reports/commands/execute.py", line 220, in _get_screenshots
    image = screenshot.get_screenshot(user=user)
  File "/app/superset/utils/screenshots.py", line 76, in get_screenshot
    self.screenshot = driver.get_screenshot(self.url, self.element, user)
  File "/app/superset/utils/webdriver.py", line 111, in get_screenshot
    driver = self.auth(user)
  File "/app/superset/utils/webdriver.py", line 89, in auth
    driver = self.create()
  File "/app/superset/utils/webdriver.py", line 86, in create
    return driver_class(**kwargs)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Argument --marionette can't be set via capabilities


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/superset/tasks/scheduler.py", line 87, in execute
    AsyncExecuteReportScheduleCommand(
  File "/app/superset/reports/commands/execute.py", line 706, in run
    raise ex
  File "/app/superset/reports/commands/execute.py", line 702, in run
    ReportScheduleStateMachine(
  File "/app/superset/reports/commands/execute.py", line 664, in run
    state_cls(
  File "/app/superset/reports/commands/execute.py", line 565, in next
    raise first_ex
  File "/app/superset/reports/commands/execute.py", line 534, in next
    self.send()
  File "/app/superset/reports/commands/execute.py", line 431, in send
    notification_content = self._get_notification_content()
  File "/app/superset/reports/commands/execute.py", line 338, in _get_notification_content
    screenshot_data = self._get_screenshots()
  File "/app/superset/reports/commands/execute.py", line 225, in _get_screenshots
    raise ReportScheduleScreenshotFailedError(
superset.reports.commands.exceptions.ReportScheduleScreenshotFailedError: Failed taking a screenshot Message: Argument --marionette can't be set via capabilities```

what actually happens.

#### Screenshots

If applicable, add screenshots to help explain your problem.


### Environment

(please complete the following information):

- browser type and version: 
ARG GECKODRIVER_VERSION=v0.32.0
ARG FIREFOX_VERSION=106.0.3

- superset version: `superset version`
Superset 0.0.0-dev
- python version: `python --version`
Python 3.8.13
- node.js version: `node -v`

- any feature flags active:
FEATURE_FLAGS = {"ALERT_REPORTS": True}

### Checklist

Make sure to follow these steps before submitting your issue - thank you!

- [v ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ v] I have reproduced the issue with at least the latest released version of superset.
- [ v] I have checked the issue tracker for the same issue and I haven't found one similar.

### Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 27 (12 by maintainers)

Most upvoted comments

Had the same bug. But found a workaround) Firstly I rolled back Apache Superset version from superset-helm-chart-0.8.5 to v2.0.0 didn’t work. Then After a week investigation I finally found the workaround: use firefox as a webdriver and the most important part - use GECKODRIVER_VERSION=v0.29.0, the latest version of the driver gave me the error Failed taking a screenshot Message: Argument --marionette can’t be set via capabilities. Want to note that Apache Superset documentation has the same version in its configuration files (GECKODRIVER_VERSION=v0.29.0), so pay attention: https://superset.apache.org/docs/installation/alerts-reports Now I am going to test the latest version of Apache Superset - superset-helm-chart-0.8.5 and will let you know about result. Also want to note Chrome webdriver couldn’t be forced to work)

Final configuration (superset_config_docker.py):

ENABLE_SCHEDULED_EMAIL_REPORTS = True
ALERT_REPORTS_NOTIFICATION_DRY_RUN = False

SMTP_HOST = "smtp.somedomain.com" 
SMTP_PORT = 25 # your port, e.g. 587
SMTP_STARTTLS = False
SMTP_SSL_SERVER_AUTH = False 
SMTP_SSL = False
SMTP_USER = "" 
SMTP_PASSWORD = "" 
SMTP_MAIL_FROM = "admin@admin.com"
EMAIL_REPORTS_SUBJECT_PREFIX = "[SELLC Superset-dev] report" 
WEBDRIVER_BASEURL = "http://superset:8088"
WEBDRIVER_BASEURL_USER_FRIENDLY = "http://localhost:8088"

SCREENSHOT_LOCATE_WAIT = 100
SCREENSHOT_LOAD_WAIT = 1200

THUMBNAIL_SELENIUM_USER = "admin" 

SQLALCHEMY_ECHO = True

SCREENSHOT_LOCATE_WAIT = 100
SCREENSHOT_LOAD_WAIT = 1200

One more note: png is working but csv still doesn’t work with the issue Failed generating csv HTTP Error 407: Authorization Required

Good luck!

Solution is then not a fix for me, as I reverted to latest stable just because of this, and given that we based our recent work on latest master, as I think is recommended in the official docs, I have host of other problems now - missing stuff, jumping charts etc. I am considering abandoning email or reimplementing it differently just so i can revert to latest as it behaves much better.

Sorry to hear that. That new users are directed to deploy latest - which changes multiple times per day - is a problem and one I brought up this week at a Superset community meeting as something I’d like to see changed. I’m not an expert on this aspect but you might experience similar problems when you eventually switch to a newer release.

Try running 2.0.0-dev instead of the latest which is appearing as 0.0.0-dev in your installation and see if that fixes it. Others have been reporting similar bugs running the latest commit from master branch.

thanks. it works for me.

Could you share your whole setup with me ? - I’m running into the same problem and changing to 2.0.0-dev doesn’t seem to work for me

Thanks for reopening this.

That new users are directed to deploy latest - which changes multiple times per day - is a problem

I understand your point, but on the other hand users can have fixes ASAP that way instead of waiting for official release and you get more “beta testers” that way… halthy master is the point. For instance, this problem would probably be discovered after the official release and now it can get fixed before…

hello, I am experiencing the same issue here, with 2.1.0rc3 @nytai with what would you override the config you mention? Did anyone manage to specify the right configs in WEBDRIVER_OPTION_ARGS?

This should be fixed in 2.1.0rc3

Why is this closed as fixed if the solution is installing older version ?

Try running 2.0.0-dev instead of the latest which is appearing as 0.0.0-dev in your installation and see if that fixes it. Others have been reporting similar bugs running the latest commit from master branch.

thanks. it works for me.