PiXOT97 opened a new issue, #33561: URL: https://github.com/apache/superset/issues/33561
### Bug description I'm encountering issues when embedding Superset dashboards using guest tokens with GLOBAL_ASYNC_QUERIES = True and GLOBAL_ASYNC_QUERIES_TRANSPORT = "polling". Shorthly I get `Unexpected Error - See More` on the chart and at the top "This session has encountered an interruption, and some controls may not work as intended. If you are the developer of this app, please check that the guest token is being generated correctly." - If I click the `Refresh Dashboard`, the data get's populated correctly. - When embedding dashboards with GLOBAL_ASYNC_QUERIES = False, no need to force refresh, the dasboard loads correctly the data. Found the same issue posted by [wulfuric](https://github.com/wulfuric) on #18814 but without a fix.  superst_config_docker.py: ```python # superset_config.py - Custom configuration overrides from datetime import timedelta, datetime import logging import os from sqlalchemy.types import Date, DateTime from celery.schedules import crontab from flask_caching.backends.filesystemcache import FileSystemCache DATABASE_DIALECT = os.getenv("DATABASE_DIALECT") DATABASE_USER = os.getenv("DATABASE_USER") DATABASE_PASSWORD = os.getenv("DATABASE_PASSWORD") DATABASE_HOST = os.getenv("DATABASE_HOST") DATABASE_PORT = os.getenv("DATABASE_PORT") DATABASE_DB = os.getenv("DATABASE_DB") REDIS_HOST = os.getenv("REDIS_HOST", "db_redis") REDIS_PORT = os.getenv("REDIS_PORT", "6379") REDIS_CELERY_DB = os.getenv("REDIS_CELERY_DB", "0") REDIS_RESULTS_DB = os.getenv("REDIS_RESULTS_DB", "1") # Redis cache configuration for general use CACHE_CONFIG = { "CACHE_TYPE": "RedisCache", "CACHE_DEFAULT_TIMEOUT": int(timedelta(days=1).total_seconds()), "CACHE_KEY_PREFIX": "superset_", "CACHE_REDIS_HOST": REDIS_HOST, "CACHE_REDIS_PORT": REDIS_PORT, "CACHE_REDIS_DB": REDIS_RESULTS_DB, } DATA_CACHE_CONFIG = CACHE_CONFIG # Redis cache for datasource metadata and query results DATA_CACHE_CONFIG = { 'CACHE_TYPE': 'RedisCache', 'CACHE_KEY_PREFIX': 'superset_data_', 'CACHE_DEFAULT_TIMEOUT': int(timedelta(days=1).total_seconds()), "CACHE_REDIS_HOST": REDIS_HOST, "CACHE_REDIS_PORT": REDIS_PORT, "CACHE_REDIS_DB": REDIS_RESULTS_DB, } # Redis cache for dashboard filter state FILTER_STATE_CACHE_CONFIG = { 'CACHE_TYPE': 'RedisCache', 'CACHE_KEY_PREFIX': 'superset_filter_', 'CACHE_DEFAULT_TIMEOUT': int(timedelta(days=90).total_seconds()), "CACHE_REDIS_HOST": REDIS_HOST, "CACHE_REDIS_PORT": REDIS_PORT, "CACHE_REDIS_DB": REDIS_RESULTS_DB, } # Redis cache for explore form data EXPLORE_FORM_DATA_CACHE_CONFIG = { 'CACHE_TYPE': 'RedisCache', 'CACHE_KEY_PREFIX': 'superset_explore_', 'CACHE_DEFAULT_TIMEOUT': int(timedelta(days=7).total_seconds()), "CACHE_REDIS_HOST": REDIS_HOST, "CACHE_REDIS_PORT": REDIS_PORT, "CACHE_REDIS_DB": REDIS_RESULTS_DB, } # Enable Jinja templating in SQL Lab and dashboards ENABLE_TEMPLATE_PROCESSING = True # Enable GLOBAL ASYNC Queries and Redis config DEFAULT_FEATURE_FLAGS = { "GLOBAL_ASYNC_QUERIES": True, "ENABLE_TEMPLATE_PROCESSING": True, "EMBEDDED_SUPERSET": True, "SQLLAB_BACKEND_PERSISTENCE": True, "DASHBOARD_CROSS_FILTERS": True, "CHART_PLUGINS_EXPERIMENTAL": True, } GLOBAL_ASYNC_QUERY_MANAGER_CLASS = ( "superset.async_events.async_query_manager.AsyncQueryManager" ) GLOBAL_ASYNC_QUERIES_REDIS_CONFIG = { "port": REDIS_PORT, "host": REDIS_HOST, "password": "", "db": REDIS_CELERY_DB, "ssl": False, } GLOBAL_ASYNC_QUERIES_REDIS_STREAM_PREFIX = 'async-events-' GLOBAL_ASYNC_QUERIES_TRANSPORT = 'polling' GLOBAL_ASYNC_QUERIES_POLLING_DELAY = int(timedelta(milliseconds=500).total_seconds() * 1000) GLOBAL_ASYNC_QUERIES_JWT_SECRET = os.getenv("GLOBAL_ASYNC_QUERIES_JWT_SECRET") # Guest token config for embedded Superset GUEST_ROLE_NAME = "Gamma" GUEST_TOKEN_JWT_SECRET = os.getenv("GUEST_TOKEN_JWT_SECRET") GUEST_TOKEN_JWT_ALGO = "HS256" GUEST_TOKEN_HEADER_NAME = "X-GuestToken" GUEST_TOKEN_JWT_EXP_SECONDS = 600 # Filter row limits NATIVE_FILTER_DEFAULT_ROW_LIMIT = 10000 FILTER_SELECT_ROW_LIMIT = 10000 # Webserver timeout for heavy queries SUPERSET_WEBSERVER_TIMEOUT = 180 PUBLIC_ROLE_LIKE_GAMMA = True # Enable CORS for embedded usage ENABLE_CORS = True CORS_OPTIONS = { "supports_credentials": True, "allow_headers": "*", "expose_headers": "*", "resources": "*", "origins": ["*"] } # Enable Proxy configuration ENABLE_PROXY_FIX = True TALISMAN_ENABLED = False WTF_CSRF_ENABLED = False ``` superset_logs: ```text 2025-05-22 11:36:35,103:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.put.warning 2025-05-22 11:36:35,103:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.put.time | 17.79254099528771 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "PUT /api/v1/dashboard/4 HTTP/1.1" 403 29 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "OPTIONS /api/v1/security/login HTTP/1.1" 200 9 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "OPTIONS /api/v1/security/login HTTP/1.1" 200 9 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "POST /api/v1/security/login HTTP/1.1" 200 509 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "POST /api/v1/security/login HTTP/1.1" 200 503 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "OPTIONS /api/v1/security/guest_token/ HTTP/1.1" 200 9 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "OPTIONS /api/v1/security/guest_token/ HTTP/1.1" 200 9 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:35,759:DEBUG:superset.stats_logger:[stats_logger] (incr) SecurityRestApi.guest_token.success 2025-05-22 11:36:35,759:DEBUG:superset.stats_logger:[stats_logger] (timing) SecurityRestApi.guest_token.time | 2.3558230022899806 2025-05-22 11:36:35,759:DEBUG:superset.stats_logger:[stats_logger] (incr) guest_token 2025-05-22 11:36:35,759:DEBUG:superset.stats_logger:[stats_logger] (incr) SecurityRestApi.guest_token.success 2025-05-22 11:36:35,759:DEBUG:superset.stats_logger:[stats_logger] (timing) SecurityRestApi.guest_token.time | 2.5347989940200932 2025-05-22 11:36:35,760:DEBUG:superset.stats_logger:[stats_logger] (incr) guest_token 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "POST /api/v1/security/guest_token/ HTTP/1.1" 200 477 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "POST /api/v1/security/guest_token/ HTTP/1.1" 200 477 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:35,869:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:35,869:DEBUG:superset.stats_logger:[stats_logger] (incr) embedded 2025-05-22 11:36:35,871:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:35,871:DEBUG:superset.stats_logger:[stats_logger] (incr) embedded 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "GET /embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L HTTP/1.1" 200 2832 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:35 +0000] "GET /embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L HTTP/1.1" 200 2832 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 99.99.100.99 - - [22/May/2025:11:36:36 +0000] "GET /api/v1/me/roles/ HTTP/1.1" 200 921 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:36,480:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:36,485:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:36,485:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.get 2025-05-22 11:36:36,490:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.get_charts.success 2025-05-22 11:36:36,490:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.get_charts.time | 29.141098006221 99.99.100.99 - - [22/May/2025:11:36:36 +0000] "GET /api/v1/dashboard/4/charts HTTP/1.1" 200 914 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:36,495:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.get.success 2025-05-22 11:36:36,495:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.get.time | 32.54863199981628 99.99.100.99 - - [22/May/2025:11:36:36 +0000] "GET /api/v1/dashboard/4 HTTP/1.1" 200 1196 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:36,578:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://postgres:XXXXXXXXXX@db_pgduckdb:5432/postgres 2025-05-22 11:36:36,579:DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: postgresql+psycopg2://postgres:XXXXXXXXXX@db_pgduckdb:5432/postgres 2025-05-22 11:36:36,595:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:36,600:DEBUG:superset.stats_logger:[stats_logger] (incr) DashboardRestApi.get_datasets.success 2025-05-22 11:36:36,600:DEBUG:superset.stats_logger:[stats_logger] (timing) DashboardRestApi.get_datasets.time | 48.75544899550732 99.99.100.99 - - [22/May/2025:11:36:36 +0000] "GET /api/v1/dashboard/4/datasets HTTP/1.1" 200 1423 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:37,006:WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key 4952948a4df25b54d7ece9a74dd9c3b1 2025-05-22 11:36:37,006:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:37,012:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartDataRestApi.data.warning 2025-05-22 11:36:37,012:DEBUG:superset.stats_logger:[stats_logger] (timing) ChartDataRestApi.data.time | 41.09184499975527 99.99.100.99 - - [22/May/2025:11:36:37 +0000] "POST /api/v1/chart/data?form_data=%7B%22slice_id%22%3A118%7D&dashboard_id=4 HTTP/1.1" 401 34 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:37,139:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartRestApi.get.warning 2025-05-22 11:36:37,139:DEBUG:superset.stats_logger:[stats_logger] (timing) ChartRestApi.get.time | 19.06752699869685 2025-05-22 11:36:37,139:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 99.99.100.99 - - [22/May/2025:11:36:37 +0000] "GET /api/v1/chart/118 HTTP/1.1" 404 29 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:37,155:WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key ef8876f01cb86dc2575b43ec4e7dbbee 2025-05-22 11:36:37,155:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:37,159:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartDataRestApi.data.warning 2025-05-22 11:36:37,159:DEBUG:superset.stats_logger:[stats_logger] (timing) ChartDataRestApi.data.time | 42.493398002989125 99.99.100.99 - - [22/May/2025:11:36:37 +0000] "POST /api/v1/chart/data HTTP/1.1" 401 34 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:37,571:WARNING:root:Class 'werkzeug.local.LocalProxy' is not mapped 2025-05-22 11:36:37,571:DEBUG:superset.stats_logger:[stats_logger] (incr) log 99.99.100.99 - - [22/May/2025:11:36:37 +0000] "POST /superset/log/?explode=events&dashboard_id=4 HTTP/1.1" 200 9 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" ``` ### Screenshots/recordings _No response_ ### Superset version 4.1.2 ### Python version 3.10 ### Node version Not applicable ### Browser Chrome ### Additional context I have looked into Celery Flower and there are no task beeing generated (on the load). Clicking the "Refresh Dashboard" button in the UI, will actually create the job and tasks in REDIS. Specific Error on Embedding Load: ``` 99.99.100.99 - - [22/May/2025:11:36:37 +0000] "GET /api/v1/chart/118 HTTP/1.1" 404 29 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" 2025-05-22 11:36:37,155:WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key ef8876f01cb86dc2575b43ec4e7dbbee ``` Same embeeding that was just loaded but pressed the Refresh Dashboard: ``` 99.99.100.99 - - [22/May/2025:13:35:19 +0000] "GET /static/assets/e72f6c518228df7f2d80.chunk.js HTTP/1.1" 200 554 "https://www.test.com/embedded/7f1a1ab9-b774-4431-871c-d8f8a4c04828?uiConfig=0&show_filters=false&expand_filters=false&SKU=SMART+WATER+APA+PLATA+1.1L" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" ``` ### Checklist - [x] I have searched Superset docs and Slack and didn't find a solution to my problem. - [x] I have searched the GitHub issue tracker and didn't find a similar bug report. - [x] 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. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
