GitHub user dosubot[bot] added a comment to the discussion: Superset charts are 
integrated with PlayWright. All charts and data on the page render completely 
without any unexpected errors before screenshotting. However, there are 
instances where the data is 0 and the chart is empty. What could be the 
problem? I am using C# and Superset version 4.0.1.

<!-- Answer -->
The most common cause for charts showing zero data or being empty in Playwright 
automation—but not in direct login—is a difference in authentication/session 
context. Superset's Playwright integration doesn't perform a UI login; instead, 
it programmatically sets session cookies for the user in the browser context. 
If these cookies are missing, expired, or set with the wrong 
domain/path/samesite attributes, the session may lack the right permissions, 
causing charts to appear empty even though the page renders without errors. 
This can also happen if Playwright is using a different user or role than your 
manual login, or if row-level security or CSRF protection blocks data access in 
automation sessions 
[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/machine_auth.py#L43-L160).

To resolve this, confirm that your Playwright automation is using the same user 
credentials and session context as your direct login. Check your Superset 
config for MACHINE_AUTH_PROVIDER_CLASS, WEBDRIVER_BASEURL, and session cookie 
settings (SESSION_COOKIE_SAMESITE, SESSION_COOKIE_HTTPONLY, 
SESSION_COOKIE_SECURE) to ensure they match your real login environment. Also, 
compare network requests and API responses between Playwright and direct login 
to spot differences in returned data or permissions. If you use caching for 
screenshots, try disabling it or forcing a refresh to rule out stale images 
[source](https://github.com/apache/superset/issues/25237#issuecomment-3355672287).

If you still see empty charts, check Superset backend logs for authentication 
or permission errors, and consider testing with a different user or the 
Public/Guest role to rule out SSO/session issues. For robust automation, always 
wait for all chart containers and loading spinners to disappear, then add a 
short delay for chart animations before taking screenshots 
[source](https://github.com/apache/superset/discussions/36845).


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/b395397a-91b6-4ab0-a33b-2a7a4cf1be89?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20most%20common%20cause%20for%20charts%20showing%20zero%20data%20or%20being%20empty%20in%20Playwright%20automation%E2%80%94but%20not%20in%20direct%20login%E2%80%94is%20a%20difference%20in%20authentication/session%20context.%20Superset%27s%20Playwright%20integration%20doesn%27t%20perform%20a%20UI%20login%3B%20instead%2C%20it%20programmatically%20sets%20session%20cookies%20for%20the%20user%20in%20the%20browser%20context.%20If%20these%20cookies%20are%20missing%2C%20expired%2C%20or%20set%20with%20the%20wrong%20domain/path/samesite%20attributes%2C%20the%20session%20may%20lack%20the%20right%20permissions%2C%20causing%20charts%20to%20appear%20empty%20even%20though%20the%20page%20renders%20without%20errors.%20This%20can%20also%20happen%20if%20Playwright%2
 
0is%20using%20a%20different%20user%20or%20role%20than%20your%20manual%20login%2C%20or%20if%20row-level%20security%20or%20CSRF%20protection%20blocks%20data%20access%20in%20automation%20sessions%20%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/utils/machine_auth.py%23L43-L160%29.%0A%0ATo%20resolve%20this%2C%20confirm%20that%20your%20Playwright%20automation%20is%20using%20the%20same%20user%20credentials%20and%20session%20context%20as%20your%20direct%20login.%20Check%20your%20Superset%20config%20for%20MACHINE_AUTH_PROVIDER_CLASS%2C%20WEBDRIVER_BASEURL%2C%20and%20session%20cookie%20settings%20%28SESSION_COOKIE_SAMESITE%2C%20SESSION_COOKIE_HTTPONLY%2C%20SESSION_COOKIE_SECURE%29%20to%20ensure%20they%20match%20your%20real%20login%20environment.%20Also%2C%20compare%20network%20requests%20and%20API%20responses%20between%20Playwright%20and%20direct%20login%20to%20spot%20differences%20in%20returned%20data%20or%20permissions.%20If%20you
 
%20use%20caching%20for%20screenshots%2C%20try%20disabling%20it%20or%20forcing%20a%20refresh%20to%20rule%20out%20stale%20images%20%5Bsource%5D%28https%3A//github.com/apache/superset/issues/25237%23issuecomment-3355672287%29.%0A%0AIf%20you%20still%20see%20empty%20charts%2C%20check%20Superset%20backend%20logs%20for%20authentication%20or%20permission%20errors%2C%20and%20consider%20testing%20with%20a%20different%20user%20or%20the%20Public/Guest%20role%20to%20rule%20out%20SSO/session%20issues.%20For%20robust%20automation%2C%20always%20wait%20for%20all%20chart%20containers%20and%20loading%20spinners%20to%20disappear%2C%20then%20add%20a%20short%20delay%20for%20chart%20animations%20before%20taking%20screenshots%20%5Bsource%5D%28https%3A//github.com/apache/superset/discussions/36845%29.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on X](https://img.shields.io/badge/X-share-black)](https://t
 
witter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36853)

GitHub link: 
https://github.com/apache/superset/discussions/36853#discussioncomment-15363807

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to