GitHub user dosubot[bot] added a comment to the discussion: ChunkLoadError when 
generating dashboard screenshot using 
/api/v1/dashboard/{pk}/cache_dashboard_screenshot/

<!-- Answer -->
This ChunkLoadError almost always means the Playwright/Chromium worker can't 
load a dynamic JS chunk because the asset URL it's trying to fetch is wrong or 
unreachable from inside the worker container. In Superset, all dynamic chunk 
URLs are built using a prefix from the bootstrap data embedded in the HTML, 
which is set by your APPLICATION_ROOT and STATIC_ASSETS_PREFIX config. If these 
don't match the actual public path Playwright uses to reach your assets in 
production, you'll get exactly this error—even if the dashboard loads fine in 
your browser.

To fix this, make sure that:
- WEBDRIVER_BASEURL, APPLICATION_ROOT, and STATIC_ASSETS_PREFIX all point to 
the same public URL and path that Playwright uses to access your Superset 
instance and its static assets.
- The Playwright/worker container can reach all static assets (including chunk 
files) at the URLs generated by the frontend. You can exec into the worker 
container and try to curl or wget a chunk file (e.g., 
`/static/assets/683.chunk.js`) using the exact URL from the browser's network 
tab.
- There are no proxy, CDN, or CORS issues blocking asset requests from the 
worker container.

In local dev, asset prefixes are often relative and accessible, but in 
production, they must match the actual CDN/proxy path exposed to Playwright. 
Any mismatch (hostnames, missing slashes, or different subpaths) will cause 
this error, even if everything looks fine in your browser because your browser 
and the worker may resolve URLs differently. The key is that the runtime prefix 
for dynamic chunk loads must match the URL space Playwright can reach. See [how 
the asset prefix is set in the 
frontend](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/public-path.ts#L19-L22)
 and [how it's derived from bootstrap 
data](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/utils/getBootstrapData.ts#L24-L54).

If you align these configs and verify asset accessibility from the worker, the 
ChunkLoadError should disappear.


<!-- 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/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/94d278de-a6ba-4742-bf1c-2df991590d37?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=This%20ChunkLoadError%20almost%20always%20means%20the%20Playwright/Chromium%20worker%20can%27t%20load%20a%20dynamic%20JS%20chunk%20because%20the%20asset%20URL%20it%27s%20trying%20to%20fetch%20is%20wrong%20or%20unreachable%20from%20inside%20the%20worker%20container.%20In%20Superset%2C%20all%20dynamic%20chunk%20URLs%20are%20built%20using%20a%20prefix%20from%20the%20bootstrap%20data%20embedded%20in%20the%20HTML%2C%20which%20is%20set%20by%20your%20APPLICATION_ROOT%20and%20STATIC_ASSETS_PREFIX%20config.%20If%20these%20don%27t%20match%20the%20actual%20public%20path%20Playwright%20uses%20to%20reach%20your%20assets%20in%20production%2C%20you%27ll%20get%20exactly%20this%20error%E2%80%94even%20if%20the%20dashboard%20loads%20fine%20in%20your%20browser.%0A%0ATo%2
 
0fix%20this%2C%20make%20sure%20that%3A%0A-%20WEBDRIVER_BASEURL%2C%20APPLICATION_ROOT%2C%20and%20STATIC_ASSETS_PREFIX%20all%20point%20to%20the%20same%20public%20URL%20and%20path%20that%20Playwright%20uses%20to%20access%20your%20Superset%20instance%20and%20its%20static%20assets.%0A-%20The%20Playwright/worker%20container%20can%20reach%20all%20static%20assets%20%28including%20chunk%20files%29%20at%20the%20URLs%20generated%20by%20the%20frontend.%20You%20can%20exec%20into%20the%20worker%20container%20and%20try%20to%20curl%20or%20wget%20a%20chunk%20file%20%28e.g.%2C%20%60/static/assets/683.chunk.js%60%29%20using%20the%20exact%20URL%20from%20the%20browser%27s%20network%20tab.%0A-%20There%20are%20no%20proxy%2C%20CDN%2C%20or%20CORS%20issues%20blocking%20asset%20requests%20from%20the%20worker%20container.%0A%0AIn%20local%20dev%2C%20asset%20prefixes%20are%20often%20relative%20and%20accessible%2C%20but%20in%20production%2C%20they%20must%20match%20the%20actual%20CDN/proxy%20path%20exposed%20to%20
 
Playwright.%20Any%20mismatch%20%28hostnames%2C%20missing%20slashes%2C%20or%20different%20subpaths%29%20will%20cause%20this%20error%2C%20even%20if%20everything%20looks%20fine%20in%20your%20browser%20because%20your%20browser%20and%20the%20worker%20may%20resolve%20URLs%20differently.%20The%20key%20is%20that%20the%20runtime%20prefix%20for%20dynamic%20chunk%20loads%20must%20match%20the%20URL%20space%20Playwright%20can%20reach.%20See%20%5Bhow%20the%20asset%20prefix%20is%20set%20in%20the%20frontend%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/public-path.ts%23L19-L22%29%20and%20%5Bhow%20it%27s%20derived%20from%20bootstrap%20data%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/utils/getBootstrapData.ts%23L24-L54%29.%0A%0AIf%20you%20align%20these%20configs%20and%20verify%20asset%20accessibility%20from%20the%20worker%2C%20the%20ChunkLoadError%20should%20disappear.)&nb
 sp;[![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://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/37062)

GitHub link: 
https://github.com/apache/superset/discussions/37062#discussioncomment-15477908

----
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