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

The filters bar crashes randomly in an embedded dashboard #32282

Open
3 tasks done
Aayush-683 opened this issue Feb 17, 2025 · 8 comments · May be fixed by #32294
Open
3 tasks done

The filters bar crashes randomly in an embedded dashboard #32282

Aayush-683 opened this issue Feb 17, 2025 · 8 comments · May be fixed by #32294
Assignees
Labels
dashboard:native-filters Related to the native filters of the Dashboard embedded

Comments

@Aayush-683
Copy link

Aayush-683 commented Feb 17, 2025

Bug description

The filters bar crashes randomly in an embedded dashboard when trying to apply/remove filters. I have not been able to isolate the cause, it just happens randomly when trying to test.

Sometimes it works, but sometimes even just selecting the filter causes this issue.

The error message is also ambiguous so i have nothing to go off of, Any help would be appreciated.

By the way, refreshing or re-calling the embedDashboard function does render it normally but it loses all the filters applied previously, forcing to start again.

Screenshots/recordings

Screen Recording of it happening
Error Message

Superset version

4.1.1

Python version

Not applicable

Node version

Not applicable

Browser

Chrome

Additional context

No response

Checklist

  • 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.
  • I have searched Superset docs and Slack and didn't find a solution to my problem.
Copy link

dosubot bot commented Feb 17, 2025

I found a similar unsolved discussion titled Unexpected JSON error when embedding, which might be related to the issue you're experiencing. Additionally, there was a closed issue, Dashboard Filter 'useFilterScope' Error, which was resolved by a pull request that involved optional chaining for a possibly nullable parent attribute in the LayoutItem type. However, since your issue is with version 4.1.1, and the closed issue was resolved in a previous version, it might not be directly applicable [1][2].

Regarding the JSON syntax error, the Superset frontend code includes error handling mechanisms for JSON parsing errors. The handleError function is designed to manage various types of errors, including JSON parsing errors, by converting them into a consistent SupersetApiError and attempting to parse the error response as JSON to extract detailed error information [3][4].

If the error persists, you might want to investigate the specific conditions under which the error occurs, such as the types of filters being applied or removed, to help isolate the cause.

To continue talking to Dosu, mention @dosu.


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

@dosubot dosubot bot added dashboard:native-filters Related to the native filters of the Dashboard embedded labels Feb 17, 2025
@hainenber
Copy link
Contributor

I have no idea why your discussion got closed but the stack trace there gives me better clue for debugging. Can you search for the tag attribute data-bootstrap and see if the corresponding value is JSON-parseable?

It's this LoC that crashed the page.

@Aayush-683
Copy link
Author

This is the data-bootstrap attribute value before the bar crashes

{'config': {'GUEST_TOKEN_HEADER_NAME': 'X-GuestToken'}, 'common': {'conf': {'SUPERSET_WEBSERVER_TIMEOUT': 60, 'SUPERSET_DASHBOARD_POSITION_DATA_LIMIT': 65535, 'SUPERSET_DASHBOARD_PERIODICAL_REFRESH_LIMIT': 0, 'SUPERSET_DASHBOARD_PERIODICAL_REFRESH_WARNING_MESSAGE': null, 'ENABLE_JAVASCRIPT_CONTROLS': null, 'DEFAULT_SQLLAB_LIMIT': 1000, 'DEFAULT_VIZ_TYPE': 'table', 'SQL_MAX_ROW': 100000, 'SUPERSET_WEBSERVER_DOMAINS': null, 'SQLLAB_SAVE_WARNING_MESSAGE': null, 'SQLLAB_DEFAULT_DBID': null, 'DISPLAY_MAX_ROW': 10000, 'GLOBAL_ASYNC_QUERIES_TRANSPORT': 'polling', 'GLOBAL_ASYNC_QUERIES_POLLING_DELAY': 500, 'SQL_VALIDATORS_BY_ENGINE': {'presto': 'PrestoDBSQLValidator', 'postgresql': 'PostgreSQLValidator'}, 'SQLALCHEMY_DOCS_URL': null, 'SQLALCHEMY_DISPLAY_TEXT': null, 'GLOBAL_ASYNC_QUERIES_WEBSOCKET_URL': 'ws://127.0.0.1:8080/', 'DASHBOARD_AUTO_REFRESH_MODE': 'force', 'DASHBOARD_AUTO_REFRESH_INTERVALS': [[0, 'Don't refresh'], [10, '10 seconds'], [30, '30 seconds'], [60, '1 minute'], [300, '5 minutes'], [1800, '30 minutes'], [3600, '1 hour'], [21600, '6 hours'], [43200, '12 hours'], [86400, '24 hours']], 'DASHBOARD_VIRTUALIZATION': null, 'SCHEDULED_QUERIES': {}, 'EXCEL_EXTENSIONS': ['xls', 'xlsx'], 'CSV_EXTENSIONS': ['txt', 'tsv', 'csv'], 'COLUMNAR_EXTENSIONS': ['zip', 'parquet'], 'ALLOWED_EXTENSIONS': ['tsv', 'zip', 'xls', 'csv', 'txt', 'parquet', 'xlsx'], 'SAMPLES_ROW_LIMIT': 1000, 'DEFAULT_TIME_FILTER': 'No filter', 'HTML_SANITIZATION': true, 'HTML_SANITIZATION_SCHEMA_EXTENSIONS': {}, 'WELCOME_PAGE_LAST_TAB': 'all', 'VIZ_TYPE_DENYLIST': [], 'ALERT_REPORTS_DEFAULT_CRON_VALUE': '0 0 * * *', 'ALERT_REPORTS_DEFAULT_RETENTION': 90, 'ALERT_REPORTS_DEFAULT_WORKING_TIMEOUT': 3600, 'NATIVE_FILTER_DEFAULT_ROW_LIMIT': 1000, 'PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET': true, 'JWT_ACCESS_CSRF_COOKIE_NAME': 'csrf_access_token', 'SQLLAB_QUERY_RESULT_TIMEOUT': 0, 'ALERT_REPORTS_NOTIFICATION_METHODS': ['Email'], 'HAS_GSHEETS_INSTALLED': true}, 'locale': 'en', 'language_pack': {'domain': 'superset', 'locale_data': {'superset': {'': {'domain': 'superset', 'plural_forms': 'nplurals=2; plural=(n != 1)', 'lang': 'en'}}}}, 'd3_format': {}, 'd3_time_format': {}, 'currencies': ['USD', 'EUR', 'GBP', 'INR', 'MXN', 'JPY', 'CNY'], 'feature_flags': {'DRUID_JOINS': false, 'DYNAMIC_PLUGINS': false, 'DISABLE_LEGACY_DATASOURCE_EDITOR': true, 'ENABLE_TEMPLATE_PROCESSING': true, 'ENABLE_JAVASCRIPT_CONTROLS': false, 'KV_STORE': false, 'PRESTO_EXPAND_DATA': false, 'THUMBNAILS': false, 'ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS': false, 'ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT': false, 'SHARE_QUERIES_VIA_KV_STORE': false, 'TAGGING_SYSTEM': false, 'SQLLAB_BACKEND_PERSISTENCE': true, 'LISTVIEWS_DEFAULT_CARD_VIEW': false, 'ESCAPE_MARKDOWN_HTML': false, 'DASHBOARD_CROSS_FILTERS': true, 'DASHBOARD_VIRTUALIZATION': true, 'GLOBAL_ASYNC_QUERIES': false, 'EMBEDDED_SUPERSET': true, 'ALERT_REPORTS': false, 'ALERT_REPORT_TABS': false, 'ALERT_REPORT_SLACK_V2': false, 'DASHBOARD_RBAC': true, 'ENABLE_ADVANCED_DATA_TYPES': false, 'ALERTS_ATTACH_REPORTS': true, 'ALLOW_FULL_CSV_EXPORT': false, 'ALLOW_ADHOC_SUBQUERY': false, 'USE_ANALAGOUS_COLORS': false, 'RLS_IN_SQLLAB': false, 'IMPERSONATE_WITH_EMAIL_PREFIX': false, 'CACHE_IMPERSONATION': false, 'CACHE_QUERY_BY_USER': false, 'EMBEDDABLE_CHARTS': true, 'DRILL_TO_DETAIL': true, 'DRILL_BY': true, 'DATAPANEL_CLOSED_BY_DEFAULT': false, 'HORIZONTAL_FILTER_BAR': false, 'ESTIMATE_QUERY_COST': false, 'SSH_TUNNELING': false, 'AVOID_COLORS_COLLISION': true, 'MENU_HIDE_USER_INFO': false, 'ENABLE_SUPERSET_META_DB': false, 'PLAYWRIGHT_REPORTS_AND_THUMBNAILS': false, 'CHART_PLUGINS_EXPERIMENTAL': false, 'SQLLAB_FORCE_RUN_ASYNC': false, 'ENABLE_FACTORY_RESET_COMMAND': false, 'SLACK_ENABLE_AVATARS': false}, 'extra_sequential_color_schemes': [], 'extra_categorical_color_schemes': [], 'theme_overrides': {}, 'menu_data': {'menu': [], 'brand': {'path': '/superset/welcome/', 'icon': '/static/assets/images/superset-logo-horiz.png', 'alt': 'Superset', 'tooltip': '', 'text': ''}, 'environment_tag': {'color': '', 'text': ''}, 'navbar_right': {'show_watermark': false, 'bug_report_url': null, 'bug_report_icon': null, 'bug_report_text': 'Report a bug', 'documentation_url': null, 'documentation_icon': null, 'documentation_text': 'Documentation', 'version_string': '4.1.1', 'version_sha': '', 'build_number': null, 'languages': {'en': {'flag': 'us', 'name': 'English', 'url': '/lang/en'}}, 'show_language_picker': false, 'user_is_anonymous': true, 'user_info_url': '/users/userinfo/', 'user_logout_url': '/logout/', 'user_login_url': '/login/', 'locale': 'en'}}, 'flash_messages': []}, 'embedded': {'dashboard_id': 10}}

This looks correct to me, i don't know what it means by unexpected }

@hainenber
Copy link
Contributor

Not really. I tossed the value into an online JSON validator and it reports to be invalid at this section

Image

If you don't mind, can you go into the Superset container and modify this LoC with following value Do not refresh and restart the container to see if it's fixed?

@hainenber hainenber self-assigned this Feb 18, 2025
@Aayush-683
Copy link
Author

Looks like that wasn't it, changed the LoC to Do not refresh. The issue still persists even though the data-bootstrap JSON shows valid

JSON:

{'config': {'GUEST_TOKEN_HEADER_NAME': 'X-GuestToken'}, 'common': {'conf': {'SUPERSET_WEBSERVER_TIMEOUT': 60, 'SUPERSET_DASHBOARD_POSITION_DATA_LIMIT': 65535, 'SUPERSET_DASHBOARD_PERIODICAL_REFRESH_LIMIT': 0, 'SUPERSET_DASHBOARD_PERIODICAL_REFRESH_WARNING_MESSAGE': null, 'ENABLE_JAVASCRIPT_CONTROLS': null, 'DEFAULT_SQLLAB_LIMIT': 1000, 'DEFAULT_VIZ_TYPE': 'table', 'SQL_MAX_ROW': 100000, 'SUPERSET_WEBSERVER_DOMAINS': null, 'SQLLAB_SAVE_WARNING_MESSAGE': null, 'SQLLAB_DEFAULT_DBID': null, 'DISPLAY_MAX_ROW': 10000, 'GLOBAL_ASYNC_QUERIES_TRANSPORT': 'polling', 'GLOBAL_ASYNC_QUERIES_POLLING_DELAY': 500, 'SQL_VALIDATORS_BY_ENGINE': {'presto': 'PrestoDBSQLValidator', 'postgresql': 'PostgreSQLValidator'}, 'SQLALCHEMY_DOCS_URL': null, 'SQLALCHEMY_DISPLAY_TEXT': null, 'GLOBAL_ASYNC_QUERIES_WEBSOCKET_URL': 'ws://127.0.0.1:8080/', 'DASHBOARD_AUTO_REFRESH_MODE': 'force', 'DASHBOARD_AUTO_REFRESH_INTERVALS': [[0, 'Do Not Refresh'], [10, '10 seconds'], [30, '30 seconds'], [60, '1 minute'], [300, '5 minutes'], [1800, '30 minutes'], [3600, '1 hour'], [21600, '6 hours'], [43200, '12 hours'], [86400, '24 hours']], 'DASHBOARD_VIRTUALIZATION': null, 'SCHEDULED_QUERIES': {}, 'EXCEL_EXTENSIONS': ['xls', 'xlsx'], 'CSV_EXTENSIONS': ['tsv', 'txt', 'csv'], 'COLUMNAR_EXTENSIONS': ['zip', 'parquet'], 'ALLOWED_EXTENSIONS': ['tsv', 'zip', 'txt', 'csv', 'parquet', 'xls', 'xlsx'], 'SAMPLES_ROW_LIMIT': 1000, 'DEFAULT_TIME_FILTER': 'No filter', 'HTML_SANITIZATION': true, 'HTML_SANITIZATION_SCHEMA_EXTENSIONS': {}, 'WELCOME_PAGE_LAST_TAB': 'all', 'VIZ_TYPE_DENYLIST': [], 'ALERT_REPORTS_DEFAULT_CRON_VALUE': '0 0 * * *', 'ALERT_REPORTS_DEFAULT_RETENTION': 90, 'ALERT_REPORTS_DEFAULT_WORKING_TIMEOUT': 3600, 'NATIVE_FILTER_DEFAULT_ROW_LIMIT': 1000, 'PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET': true, 'JWT_ACCESS_CSRF_COOKIE_NAME': 'csrf_access_token', 'SQLLAB_QUERY_RESULT_TIMEOUT': 0, 'ALERT_REPORTS_NOTIFICATION_METHODS': ['Email'], 'HAS_GSHEETS_INSTALLED': true}, 'locale': 'en', 'language_pack': {'domain': 'superset', 'locale_data': {'superset': {'': {'domain': 'superset', 'plural_forms': 'nplurals=2; plural=(n != 1)', 'lang': 'en'}}}}, 'd3_format': {}, 'd3_time_format': {}, 'currencies': ['USD', 'EUR', 'GBP', 'INR', 'MXN', 'JPY', 'CNY'], 'feature_flags': {'DRUID_JOINS': false, 'DYNAMIC_PLUGINS': false, 'DISABLE_LEGACY_DATASOURCE_EDITOR': true, 'ENABLE_TEMPLATE_PROCESSING': true, 'ENABLE_JAVASCRIPT_CONTROLS': false, 'KV_STORE': false, 'PRESTO_EXPAND_DATA': false, 'THUMBNAILS': false, 'ENABLE_DASHBOARD_SCREENSHOT_ENDPOINTS': false, 'ENABLE_DASHBOARD_DOWNLOAD_WEBDRIVER_SCREENSHOT': false, 'SHARE_QUERIES_VIA_KV_STORE': false, 'TAGGING_SYSTEM': false, 'SQLLAB_BACKEND_PERSISTENCE': true, 'LISTVIEWS_DEFAULT_CARD_VIEW': false, 'ESCAPE_MARKDOWN_HTML': false, 'DASHBOARD_CROSS_FILTERS': true, 'DASHBOARD_VIRTUALIZATION': true, 'GLOBAL_ASYNC_QUERIES': false, 'EMBEDDED_SUPERSET': true, 'ALERT_REPORTS': false, 'ALERT_REPORT_TABS': false, 'ALERT_REPORT_SLACK_V2': false, 'DASHBOARD_RBAC': true, 'ENABLE_ADVANCED_DATA_TYPES': false, 'ALERTS_ATTACH_REPORTS': true, 'ALLOW_FULL_CSV_EXPORT': false, 'ALLOW_ADHOC_SUBQUERY': false, 'USE_ANALAGOUS_COLORS': false, 'RLS_IN_SQLLAB': false, 'IMPERSONATE_WITH_EMAIL_PREFIX': false, 'CACHE_IMPERSONATION': false, 'CACHE_QUERY_BY_USER': false, 'EMBEDDABLE_CHARTS': true, 'DRILL_TO_DETAIL': true, 'DRILL_BY': true, 'DATAPANEL_CLOSED_BY_DEFAULT': false, 'HORIZONTAL_FILTER_BAR': false, 'ESTIMATE_QUERY_COST': false, 'SSH_TUNNELING': false, 'AVOID_COLORS_COLLISION': true, 'MENU_HIDE_USER_INFO': false, 'ENABLE_SUPERSET_META_DB': false, 'PLAYWRIGHT_REPORTS_AND_THUMBNAILS': false, 'CHART_PLUGINS_EXPERIMENTAL': false, 'SQLLAB_FORCE_RUN_ASYNC': false, 'ENABLE_FACTORY_RESET_COMMAND': false, 'SLACK_ENABLE_AVATARS': false}, 'extra_sequential_color_schemes': [], 'extra_categorical_color_schemes': [], 'theme_overrides': {}, 'menu_data': {'menu': [], 'brand': {'path': '/superset/welcome/', 'icon': '/static/assets/images/superset-logo-horiz.png', 'alt': 'Superset', 'tooltip': '', 'text': ''}, 'environment_tag': {'color': '', 'text': ''}, 'navbar_right': {'show_watermark': false, 'bug_report_url': null, 'bug_report_icon': null, 'bug_report_text': 'Report a bug', 'documentation_url': null, 'documentation_icon': null, 'documentation_text': 'Documentation', 'version_string': '4.1.1', 'version_sha': '', 'build_number': null, 'languages': {'en': {'flag': 'us', 'name': 'English', 'url': '/lang/en'}}, 'show_language_picker': false, 'user_is_anonymous': true, 'user_info_url': '/users/userinfo/', 'user_logout_url': '/logout/', 'user_login_url': '/login/', 'locale': 'en'}}, 'flash_messages': []}, 'embedded': {'dashboard_id': 10}}

StackTrace:
Image

@hainenber
Copy link
Contributor

I think the bootstrap data with enclosed single quotes for both keys and values is the RC here.

Image

I don't have any available app to test for embedded dashboard so the debugging is pretty raw here. Can you use the linked PR's branch to build out a custom Superset image to verify whether my PR works? Appreciate

@Aayush-683
Copy link
Author

I have the app running in production, let me see if i can get the custom image to work. Also wouldn't it be easier to just replace ' with " in the getBootstrapData.ts file in superset-embedded-sdk?

@hainenber
Copy link
Contributor

It's better to sanitize with a proper battle-tested library than to have a crude replacement. Be careful with debugging on production! I was under impression you are working with dev Superset instance instead 🥵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:native-filters Related to the native filters of the Dashboard embedded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants