We are observing an issue across our development, staging, and production environments. After a fresh build—whether running locally with pnpm build && pnpm start or after a new deployment on Vercel—the very first request to the Speed Insights endpoint (e.g., http://localhost:3000/_vercel/speed-insights/script.js) returns HTML (the default Next.js 404 page) instead of the expected JavaScript asset. This causes a SyntaxError: Unexpected token '<' in the browser console.
Once the initial request is made, the route becomes “warmed up” and subsequent requests correctly load the JavaScript file.
If our understanding is correct, the initial request to /_vercel/speed-insights/script.js returns fallback HTML due to a cold start. Could you investigate pre-generating or caching this endpoint on deployment, or another graceful handling of cold starts? This would prevent the transient error and reduce log noise.
Thank you.