Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import a Dashboard from a dockerized Superset v 2.1.0 deployment to another (same version) #26130

Closed
3 tasks done
fbgeobit opened this issue Nov 29, 2023 · 14 comments
Closed
3 tasks done

Comments

@fbgeobit
Copy link

fbgeobit commented Nov 29, 2023

On Superset v 2.1.0, I can't import a finished dashboard exported from an existing deployment on Superset v 2.1.0.

How to reproduce the bug

  1. On Superset v 2.1.0, I create a new dashboard with necessary, DB, datasets and charts. Once completed, I exported it from main Dashboards screen, by clicking "Export" menu on selected dashboard.
  2. Then, on a different installation, I try to import it from main Dashboards screen by clicking on "Import dashboards" top right button.
  3. After some seconds, an error arises on "Import dashboard" window with following info:

An error occurred while importing dashboard: Error importing dashboard. Please re-export your file and try importing again

  1. Importing dashboard fails.

Expected results

Importing dashboards from a installation of Superset to another of same version (2.1.0 in this case) should work properly.

Actual results

The import fails

Screenshots

imagen

Environment

  • browser type and version: Mozilla Firefox 115.5.0esr (64-bit)
  • docker Client: Docker Engine - Community Version: 24.0.4
  • docker Server: Docker Engine - Community Version: 23.0.1
  • docker-compose version: Docker Compose version v2.19.1
  • superset version: 2.1.0
  • python version: Python 3.8.16
  • node.js version: 16.9.1
  • any feature flags active:
    - FEATURE_FLAGS
# FEATURE_FLAGS = {
        "ALERT_REPORTS": True,
        "ENABLE_TEMPLATE_PROCESSING": True,
        "ENABLE_TEMPLATE_REMOVE_FILTERS": True,
        "DASHBOARD_NATIVE_FILTERS": True,
        "DASHBOARD_CROSS_FILTERS": True,
        "EMBEDDED_SUPERSET": True,
        "DASHBOARD_RBAC": True,
        "DRILL_TO_DETAIL": True,
        "HORIZONTAL_FILTER_BAR": True
        }
  • CUSTOM FEATURES
   # CUSTOM FEATURES
      SESSION_COOKIE_SAMESITE = 'Lax'
      SESSION_COOKIE_HTTPONLY = False
      GUEST_ROLE_NAME = "Admin"
      WTF_CSRF_ENABLED = False
      ENABLE_PROXY_FIX = True
      SUPERSET_WEBSERVER_PROTOCOL = "https"
      SUPERSET_WEBSERVER_TIMEOUT = '20 minutes'
      TALISMAN_ENABLED = False

Checklist

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

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset. (but I need v2 .1.0 for production)
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Docker containers:

sudo docker-compose -f /opt/superset/docker-compose-non-dev.yml ps
NAME                   IMAGE                   COMMAND                  SERVICE                CREATED             STATUS                    PORTS
superset_app           apache/superset:2.1.0   "/app/docker/docker-…"   superset               2 months ago        Up 2 months (healthy)     0.0.0.0:8088->8088/tcp, :::8088->8088/tcp
superset_cache         redis:7                 "docker-entrypoint.s…"   redis                  2 months ago        Up 2 months               6379/tcp
superset_db            postgres:14             "docker-entrypoint.s…"   db                     2 months ago        Up 2 months               5432/tcp
superset_worker        apache/superset:2.1.0   "/app/docker/docker-…"   superset-worker        2 months ago        Up 2 months (unhealthy)   8088/tcp
superset_worker_beat   apache/superset:2.1.0   "/app/docker/docker-…"   superset-worker-beat   2 months ago        Up 2 months               8088/tcp

python stacktraces

INFO:superset.dashboards.commands.importers.dispatcher:Command failed validation
CommandException
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/views/base_api.py", line 122, in wraps
    raise ex
  File "/app/superset/views/base_api.py", line 113, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1586, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/utils/log.py", line 266, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 100, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/dashboards/api.py", line 1060, in import_
    command.run()
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 64, in run
    raise exc
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 57, in run
    command.run()
  File "/app/superset/commands/importers/v1/__init__.py", line 64, in run
    self.validate()
  File "/app/superset/commands/importers/v1/__init__.py", line 98, in validate
    raise exception
superset.commands.exceptions.CommandInvalidError: Error importing dashboard
2023-11-29 11:08:29,619:WARNING:superset.views.base:CommandException
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/views/base_api.py", line 122, in wraps
    raise ex
  File "/app/superset/views/base_api.py", line 113, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1586, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/utils/log.py", line 266, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 100, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/dashboards/api.py", line 1060, in import_
    command.run()
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 64, in run
    raise exc
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 57, in run
    command.run()
  File "/app/superset/commands/importers/v1/__init__.py", line 64, in run
    self.validate()
  File "/app/superset/commands/importers/v1/__init__.py", line 98, in validate
    raise exception
superset.commands.exceptions.CommandInvalidError: Error importing dashboard
@nayanmshah
Copy link

Any updates? I am facing this issue as well

@fbgeobit
Copy link
Author

fbgeobit commented Jan 9, 2024

Hi @nayanmshah,
I have no updates from my side.
My intention is to try exporting/importing dashboards between two production deployments from simple to more and more complex until discover when it crashes to try catching the problem....
Have you better ideas...?

@gonzaloramosf
Copy link

Hi @nayanmshah, I have no updates from my side. My intention is to try exporting/importing dashboards between two production deployments from simple to more and more complex until discover when it crashes to try catching the problem.... Have you better ideas...?

Any updates on that. I'm currently facing the same issue.

@nayanmshah
Copy link

nayanmshah commented Jan 31, 2024 via email

@rusackas
Copy link
Member

Just to make sure, is VERSIONED_EXPORT turned on in both instances?

@fbgeobit
Copy link
Author

If the superset installation from which you exported was a docker-container installation, the one where you import it also needs to be a docker-container installation and (not locally installed superset). That solved my issue. Also have the database secret be the same as the original one. I just made it identical just to make sure that it was not the reason for failure. Thanks, NS.

On Wed, Jan 31, 2024 at 10:45 AM Gonzalo Ramos Farinho < @.> wrote: Hi @nayanmshah https://github.com/nayanmshah, I have no updates from my side. My intention is to try exporting/importing dashboards between two production deployments from simple to more and more complex until discover when it crashes to try catching the problem.... Have you better ideas...? Any updates on that. I'm currently facing the same issue. — Reply to this email directly, view it on GitHub <#26130 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFVINC6WWOTMAHNMYXDS7DYRKGNJAVCNFSM6AAAAAA77MBQ4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJZG4ZDAMJVHE . You are receiving this because you were mentioned.Message ID: @.>

Thanks @nayanmshah , both installations (from which I'm exporting and from which I'm exporting) are dockerized.

@fbgeobit
Copy link
Author

Just to make sure, is VERSIONED_EXPORT turned on in both instances?

No, that flag is not turned on in the instances. I'm checking it and let you now. Thanks @rusackas .

@fbgeobit
Copy link
Author

Hi @rusackas :
I added the flag "VERSIONED_EXPORT": True in both dockerized instances (v2.1.0), but no luck yet.

imagen

superset_app log:

2024-02-14 09:36:57,953:INFO:superset.dashboards.commands.importers.dispatcher:Command failed validation
CommandException
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1517, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1503, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/views/base_api.py", line 122, in wraps
    raise ex
  File "/app/superset/views/base_api.py", line 113, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1586, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/utils/log.py", line 266, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 100, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/dashboards/api.py", line 1060, in import_
    command.run()
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 64, in run
    raise exc
  File "/app/superset/dashboards/commands/importers/dispatcher.py", line 57, in run
    command.run()
  File "/app/superset/commands/importers/v1/__init__.py", line 64, in run
    self.validate()
  File "/app/superset/commands/importers/v1/__init__.py", line 98, in validate
    raise exception
superset.commands.exceptions.CommandInvalidError: Error importing dashboard

No errros on superset_db logs.

Is there any other log I should check?

@rusackas
Copy link
Member

Not sure about where to dig in the logs (@betodealmeida might know). While we ought to find a way to resolve this, we can't do much digging as we don't support Superset 2.x any more. There's also a CLI tool that might help as well.

@fbgeobit
Copy link
Author

Understood.
I will try to update Superset version on my 10 dockerized installations...!
I cross fingers I don't need to redo all reports...!
Thanks for your help.

@rusackas
Copy link
Member

OK, well... good luck and let us know if we can help. Closing for now, but happy to revisit or reopen if/when needed.

@fbgeobit
Copy link
Author

fbgeobit commented Feb 28, 2024 via email

@fbgeobit
Copy link
Author

Hi All,
Finally I discovered the problem and how to fix it, getting help from a developer colleague (thanks mate!).
Below I summarize the problem found and the solution in case others find it useful:

  • Even though a dashboard is working correctly in your previous installation, when trying to import it from one installation to a new one, many times an error that prevents such importation appears. But that error doesn't provide much details of possible causes.

  • To get more info about this problem:

  • In the Internet browser, open the debugging console (in Firefox: press F12 key).

  • In the 'Network' tab, search for and select the error in fuchsia (possibly a 422).

  • In the right panel, select the 'Response' tab.

  • Expand all the fields of the HTTP response JSON to see in which files and fields that build the dashboard structure the error is occurring.
    Sample JSON showing wrong parameters on each dataset file

  • A common case is that the error is related to incorrect values that are assigned to the template_params parameter during the export. When exporting the dashboard, this field acquires the value template_params: '' . I think this parameter is related to jinja SQL templating (https://superset.apache.org/docs/installation/sql-templating/).

  • To fix it, unzip the exported zip file containing the dashboard structure.

  • Search in the YAML files for the problematic field, based on the file paths and errors described in the JSON file obtained from the browser.
    Searching wrong parameters on YAML file

  • In the case described, the value '' should be replaced with null: template_params: null.
    Writing right value on parameter

  • Compress the directory with the dashboard structure back into the zip file.

  • Import again the zipped dashboard into your new Superset installation.

  • Error should not appear.
    Maybe your error when importing a dashboard is not the same that the one described, but at least, you know how to start debugging it!
    Hope it helps.
    Thanks again for your support.

@challenger009
Copy link

Hi All, Finally I discovered the problem and how to fix it, getting help from a developer colleague (thanks mate!). Below I summarize the problem found and the solution in case others find it useful:

  • Even though a dashboard is working correctly in your previous installation, when trying to import it from one installation to a new one, many times an error that prevents such importation appears. But that error doesn't provide much details of possible causes.
  • To get more info about this problem:
  • In the Internet browser, open the debugging console (in Firefox: press F12 key).
  • In the 'Network' tab, search for and select the error in fuchsia (possibly a 422).
  • In the right panel, select the 'Response' tab.
  • Expand all the fields of the HTTP response JSON to see in which files and fields that build the dashboard structure the error is occurring.
    Sample JSON showing wrong parameters on each dataset file
  • A common case is that the error is related to incorrect values that are assigned to the template_params parameter during the export. When exporting the dashboard, this field acquires the value template_params: '' . I think this parameter is related to jinja SQL templating (https://superset.apache.org/docs/installation/sql-templating/).
  • To fix it, unzip the exported zip file containing the dashboard structure.
  • Search in the YAML files for the problematic field, based on the file paths and errors described in the JSON file obtained from the browser.
    Searching wrong parameters on YAML file
  • In the case described, the value '' should be replaced with null: template_params: null.
    Writing right value on parameter
  • Compress the directory with the dashboard structure back into the zip file.
  • Import again the zipped dashboard into your new Superset installation.
  • Error should not appear.
    Maybe your error when importing a dashboard is not the same that the one described, but at least, you know how to start debugging it!
    Hope it helps.
    Thanks again for your support.

Thanks for the trick!!!! Expand all the fields of the HTTP response JSON is the key ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants