500 Internal Server on javascript chunk file

I’ve been running into a issue with my production site hosted on Cloudflare Pages. Occasionally, the main JavaScript index chunk file (likely the main app chunk) fails to load, and I get a 500 Internal Server Error in the Network tab. The site gets stuck at 0% loading. This happens randomly and rarely, but it’s been reported by multiple users and I’ve reproduced it on different devices. Here’s what I’ve observed and tried so far: Using Next.js with SSG (Static Site Generation) with no server-side rendering or API routes. No build errors Only happens on the production site, the dev environment (also hosted on cloudflare pages with .pages.dev) doesn’t show this issue at all. Purging the Cloudflare cache seems to temporarily fix it, but the issue keeps returning randomly. Since the app is statically built and the data comes from getStaticProps, I doubt it's a code issue. Could it be more like a caching or edge propagation problem Has anyone experienced something similar? What’s the best way to debug this kind of issue on Cloudflare Pages?
3 Replies
Erisa
Erisa7mo ago
?pages-logs
SuperHelpflare
SuperHelpflare7mo ago
If you're looking to tail a Pages Function you can do so in the UI here: https://dash.cloudflare.com?to=/:account/pages/view/:pages-project/:pages-deployment/functions or with Wrangler: wrangler pages deployment tail [deploymentId/url]
Erisa
Erisa7mo ago
The logs should help show whether its a code/framework issue or a cloudflare platform issue

Did you find this page helpful?