diff --git a/src/modules/browse/browse.router.ts b/src/modules/browse/browse.router.ts index 3e11247d0..943a89788 100644 --- a/src/modules/browse/browse.router.ts +++ b/src/modules/browse/browse.router.ts @@ -1,7 +1,7 @@ import { z } from 'zod'; import { TRPCError } from '@trpc/server'; -import { BrowserContext, connect, ScreenshotOptions, TimeoutError } from '@cloudflare/puppeteer'; +import { BrowserContext, connect, ScreenshotOptions } from '@cloudflare/puppeteer'; import { default as TurndownService } from 'turndown'; import { load as cheerioLoad } from 'cheerio'; @@ -134,7 +134,8 @@ async function workerPuppeteer( result.stopReason = 'end'; } } catch (error: any) { - const isTimeout = error instanceof TimeoutError; + // This was "error instanceof TimeoutError;" but threw some type error - trying the below instead + const isTimeout = error?.message?.includes('Navigation timeout') || false; result.stopReason = isTimeout ? 'timeout' : 'error'; if (!isTimeout) { result.error = '[Puppeteer] ' + (error?.message || error?.toString() || 'Unknown goto error');