mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 12:54:29 +00:00
Two bugs in getSharedBrowser() could take down the entire Vite dev server: 1. Unhandled rejection from puppeteer.launch() — the timeout error surfaces through puppeteer's internal RxJS chain, and any uncaught path crashes the Node process. The thumbnail route's try/catch doesn't always intercept it. 2. _browserLaunchPromise was never reset on failure, so subsequent thumbnail requests reused a stale rejected promise instead of retrying. Wrap the IIFE in try/catch, return null on any failure (the thumbnail route already handles a null adapter result with a 500), and reset _browserLaunchPromise in a finally block so a transient launch failure doesn't poison the singleton. Also drop the launch timeout from puppeteer's 30s default to 10s so a wedged handshake fails fast instead of stalling every pending thumbnail. Verified locally: the dev server now logs "[Studio] puppeteer launch failed — thumbnails disabled: ..." and keeps serving the studio UI after a thumbnail request fails.