Skip to content

Unable to Download(pdf and image) superset dashboard #30866

Closed

Description

@krishanthvs

Bug description

2024-11-07 18:31:29,234:INFO:superset.utils.screenshots:Attempting to get from cache: e82a8cd667ff78eb64d379e72b7b77e0
2024-11-07 18:31:29,234:INFO:superset.utils.screenshots:Failed at getting from cache: e82a8cd667ff78eb64d379e72b7b77e0
2024-11-07 18:31:29,241:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.screenshot.warning
2024-11-07 18:31:29,242:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.screenshot.time | 9.657113812863827
2024-11-07 18:31:29,242:INFO:werkzeug:106.51.85.80 - - [07/Nov/2024 18:31:29] "GET /api/v1/dashboard/1/screenshot/e82a8cd667ff78eb64d379e72b7b77e0/?download_format=pdf HTTP/1.1" 404 -
I have installed superset in ec2 machine. I am getting this error in the logs.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.11

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • 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.

Activity

  1. krishanthvs commented on Nov 7, 2024

    @krishanthvs
    Author

    @rusackas can you please check on this

  2. dosubot commented on Nov 7, 2024

    @dosubot

    It looks like you're encountering a 404 error when trying to download the Superset dashboard as a PDF or image. This issue often arises because the image is not ready yet when the system attempts to fetch it. The function fetchImageWithRetry is designed to retry fetching the image, but if it's still not ready after the maximum number of retries, the download fails [1].

    Common reasons for a screenshot not being ready include the page not being fully loaded, chart containers not rendered, or unexpected errors on the page. Ensuring the page is fully loaded and adjusting wait times for elements to render can help mitigate these issues [2].

    In an EC2 environment, make sure you have the necessary configurations and dependencies set up, such as enabling the "ALERT_REPORTS" feature flag, configuring Celery, and installing a headless browser like Chrome or Firefox [3].

    Since you've already reached out to @rusackas, it might be helpful for them to take a look at this issue as well.

    To continue talking to Dosu, mention @dosu.

  3. krishanthvs commented on Nov 8, 2024

    @krishanthvs
    Author

    @rusackas can you please help me on this. I am able to download the charts but when i am downloading the dashboard its not downloading

  4. krishanthvs commented on Nov 8, 2024

    @krishanthvs
    Author

    @dosu can you please assign some one for the same

  5. dosubot commented on Nov 8, 2024

    @dosubot

    A maintainer has already been looped in.

    To continue talking to Dosu, mention @dosu.

  6. krishanthvs commented on Nov 11, 2024

    @krishanthvs
    Author

    @rusackas can you please help me on this

  7. rusackas commented on Nov 12, 2024

    @rusackas
    Member

    Not sure why you're calling me out personally on this one so often... I have no idea, and there's certainly not enough info on this ticket to say if it's a reproducible bug, rather than a config issue. You don't say how you installed Superset, what steps you followed, or where docs fell short.

    I would join slack and try the #deloying-superset channel, or even #ask-ai. Alternatively, you can sidestep the problem by using a hosted solution.

  8. added
    requires:more-infoRequires more information from author
    and removed on Nov 12, 2024
  9. krishanthvs commented on Nov 14, 2024

    @krishanthvs
    Author

    @rusackas Whenever i ask for help from a maintainer the dosu bot throws your id.. So tagged you here. I have installed superset on EC2 machine and when i am trying to download the dashboard this error is showing in the logs:
    2024-11-07 18:31:29,234:INFO:superset.utils.screenshots:Attempting to get from cache: e82a8cd667ff78eb64d379e72b7b77e0
    2024-11-07 18:31:29,234:INFO:superset.utils.screenshots:Failed at getting from cache: e82a8cd667ff78eb64d379e72b7b77e0
    2024-11-07 18:31:29,241:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.screenshot.warning
    2024-11-07 18:31:29,242:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.screenshot.time | 9.657113812863827
    2024-11-07 18:31:29,242:INFO:werkzeug:106.51.85.80 - - [07/Nov/2024 18:31:29] "GET /api/v1/dashboard/1/screenshot/e82a8cd667ff78eb64d379e72b7b77e0/?download_format=pdf HTTP/1.1" 404 -
    superset_download_issue

  10. krishanthvs commented on Nov 28, 2024

    @krishanthvs
    Author

    @michael-s-molina can you please help me on this.

  11. michael-s-molina commented on Nov 28, 2024

    @michael-s-molina
    Member

    Hi @krishanthvs. Given that this seems like a configuration issue, I can point you to some resources that might help:

    • Read this PR to understand the difference between sync and async screenshot generation
    • Make sure you're using the sync version (ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS and ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT are False)
    • Use a stable release 4.1.1 instead of master
  12. krishanthvs commented on Dec 6, 2024

    @krishanthvs
    Author

    Hi @michael-s-molina I changed the feature flags true still its showing the same error

  13. krishanthvs commented on Dec 6, 2024

    @krishanthvs
    Author

    2024-12-06 16:29:49,351:INFO:superset.dashboards.api:Triggering screenshot ASYNC
    2024-12-06 16:29:49,558:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:49,559:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:52,783:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:52,783:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:55,909:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:55,910:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:59,055:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:29:59,055:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:02,238:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:02,239:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:05,363:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:05,363:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:08,510:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:08,511:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:11,640:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:11,640:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:14,776:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:14,777:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:17,945:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:17,945:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:21,078:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:21,079:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:24,224:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:24,225:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:27,651:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:27,651:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:30,790:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:30,790:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:33,907:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:33,907:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:37,058:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:37,058:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:40,187:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:40,187:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:43,319:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:43,319:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:46,456:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:46,457:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:49,622:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:49,622:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:52,738:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:52,738:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:55,888:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:55,888:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:58,979:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:30:58,979:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:02,122:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:02,122:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:05,271:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:05,271:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:08,406:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:08,406:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:11,534:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:11,534:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:14,658:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:14,658:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:17,820:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:17,820:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:20,970:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:20,971:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:24,563:INFO:superset.utils.screenshots:Attempting to get from c ache: 3e2d616d80b472d33efc0d2bf905bd47
    2024-12-06 16:31:24,563:INFO:superset.utils.screenshots:Failed at getting from c ache: 3e2d616d80b472d33efc0d2bf905bd47

  14. krishanthvs commented on Dec 6, 2024

    @krishanthvs
    Author

    @michael-s-molina Its doing download in async. How to do it in sync.

  15. michael-s-molina commented on Dec 6, 2024

    @michael-s-molina
    Member

    @michael-s-molina Its doing download in async. How to do it in sync.

    Make sure you're using the sync version (ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS and ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT are False)

    👆🏼

  16. michael-s-molina commented on Dec 6, 2024

    @michael-s-molina
    Member

    Hi @michael-s-molina I changed the feature flags true still its showing the same error

    The feature flags should be FALSE not true

  17. krishanthvs commented on Dec 6, 2024

    @krishanthvs
    Author

    @michael-s-molina I have set this to false. Still getting the same error

  18. michael-s-molina commented on Dec 6, 2024

    @michael-s-molina
    Member

    2024-12-06 16:29:49,351:INFO:superset.dashboards.api:Triggering screenshot ASYNC

    @krishanthvs If the above line is in your logs, it means that there's something wrong with your configuration and the feature flag is not being applied.

  19. sundar68 commented on Dec 15, 2024

    @sundar68

    @krishanthvs
    I am also facing the same issue, have you found any solution for this?

  20. krishanthvs commented on Jan 3, 2025

    @krishanthvs
    Author

    @dosu I have changed the feature flag as suggested by the maintainer. Still getting the same error

  21. dosubot commented on Jan 3, 2025

    @dosubot

    If you're still encountering issues with the feature flags not being applied correctly, here are a few things to check:

    1. Configuration in superset_config.py: Ensure that the FEATURE_FLAGS dictionary in your superset_config.py file correctly sets ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS and ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT to False. This should override the default settings [1].

    2. Environment Variables: Check if there are any environment variables prefixed with SUPERSET_FEATURE_ that might be overriding your configuration. These can affect the feature flags if set incorrectly.

    3. Custom Functions: If you have custom functions like GET_FEATURE_FLAGS_FUNC or IS_FEATURE_ENABLED_FUNC, verify that they are not altering the feature flags unexpectedly.

    4. Frontend Initialization: Ensure that the frontend is correctly initializing the feature flags. If uiCore.initFeatureFlags() is not called or is called with incorrect values, the feature flags might not be set as expected in the frontend environment [2].

    5. Merging Logic: Double-check the merging logic between DEFAULT_FEATURE_FLAGS and FEATURE_FLAGS to ensure it is functioning as intended.

    If these steps don't resolve the issue, it might be helpful to review the logs for any errors or exceptions that could indicate why the feature flags are not being applied.

    A maintainer has already been looped in.

    To continue talking to Dosu, mention @dosu.


    Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

  22. krishanthvs commented on Jan 3, 2025

    @krishanthvs
    Author

    @michael-s-molina this the superset_config.py at my end. Is there any error in this setup
    SECRET_KEY='Kumar-FSMK0521'
    WTF_CSRF_ENABLED = False
    TALISMAN_ENABLED = True
    ALERT_REPORTS = True
    DASHBOARD_VIRTUALIZATION = True
    LOGO_RIGHT_TEXT = ""
    APP_NAME = ''
    APP_ICON='/static/assets/images/logo_1.png'
    APP_ICON_WIDTH = 200
    DASHBOARD_RBAC= True
    FEATURE_FLAGS = {

    "DASHBOARD_RBAC": True,
    "EMBEDDED_SUPERSET": True,
    "ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS": False,
    "ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT": False
    }

    DISPLAY_MAX_ROW = 50000

    CELERY_TASK_EAGER_PROPAGATES = True
    CELERY_TASK_ALWAYS_EAGER = True

  23. krishanthvs commented on Jan 6, 2025

    @krishanthvs
    Author

    @michael-s-molina any updates on this

  24. krishanthvs commented on Jan 7, 2025

    @krishanthvs
    Author

    @sundar68 Reinstall superset with latest pull of git. Its working for me now

  25. ElijahKyule commented on Jan 27, 2025

    @ElijahKyule

    @michael-s-molina any updates on this

    Hi @krishanthvs I experienced a similar issue. Do you have a scrollable table in your dashboard? try removing it and see if it works

  26. renat-murtazin commented on Feb 23, 2025

    @renat-murtazin

    I experienced the same. In my case I had a Markdown element on a dashboard with the following code inside:

    <p align="center">
      <img src="https://www.site.org/sites/default/files/image.png" alt="Dashboard" width="600">
    </p>
    

    Image did not render on a dashboard and in Chrome Inspector the following error was showing:

    Refused to load the image 'https://www.site.org/sites/default/files/image.png' because it violates the following Content Security Policy directive: "img-src 'self' blob: data: https://apachesuperset.gateway.scarf.sh https://static.scarf.sh/".

    Well, although I have not succeeded in making superset render images in Markdown, removing that from a dashboard allowed me to export a dashboard into a pdf or an image.

    Make sure, you do not have errors on a page during its rendering.

    P.S. I change actual URL to an image in this message just in case.

  27. hi-im-mike commented on Apr 18, 2025

    @hi-im-mike

    @michael-s-molina any updates on this

    Hi @krishanthvs I experienced a similar issue. Do you have a scrollable table in your dashboard? try removing it and see if it works

    @krishanthvs @michael-s-molina @ElijahKyule

    I do - and it only shows the current section that is in view when exporting to pdf/image. Wondering if anyone was able to get this to work?

    I'm running Superset 4.1.1 with my config as:

    WEBDRIVER_TYPE = 'chrome'
    SCREENSHOT_SELENIUM_ANIMATION_WAIT = 10
    DASHBOARD_VIRTUALIZATION = True
    FEATURE_FLAGS = {
        'DASHBOARD_NATIVE_FILTERS': True,
        'HORIZONTAL_FILTER_BAR': True,
        'ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT': False,
        'ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS': False,
        'ENABLE_TEMPLATE_PROCESSING': True,
        "EMBEDDED_SUPERSET": True
    }
    

    Tried using a web-browser to get PDF export to work; though it still only shows whatever section is scrolled upon versus all rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    requires:more-infoRequires more information from author

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions