Back to articles
Why Puppeteer keeps timing out in production (and what to do instead)

Why Puppeteer keeps timing out in production (and what to do instead)

via Dev.to WebdevCustodia-Admin

Why Puppeteer keeps timing out in production (and what to do instead) Your Puppeteer screenshot works locally. Takes 2 seconds. You deploy to production. Suddenly: timeouts. Every 3rd request fails. Your error logs are full of: TimeoutError: Waiting for navigation to "https://example.com" failed: Timeout 30000ms exceeded or Error: Browser.newPage(): target page crashed You're not alone. This is the #1 problem with running Puppeteer in production. Why Puppeteer times out 1. Memory exhaustion Each Puppeteer instance holds a browser process (~150MB base + page overhead). Under load, memory fills up fast. // This looks fine... for ( let i = 0 ; i < 1000 ; i ++ ) { const page = await browser . newPage (); await page . goto ( url ); const screenshot = await page . screenshot (); // FORGOT TO CLOSE PAGE // page.close(); // ← This line missing } Forgot to close pages? Memory bloat. Browser slows down. Next page timeout. Or you have a memory leak in page closure — pages pile up in memory even a

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
3 views

Related Articles