{"record":{"id":"d5df73afaaa1fbe5","repo":"decolua/9router","slug":"proxyfetch-got-scraping-unavailable-falling-bac","errorCode":null,"errorMessage":"[ProxyFetch] got-scraping unavailable, falling back to native fetch: ${e.message}","messagePattern":"\\[ProxyFetch\\] got-scraping unavailable, falling back to native fetch: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"open-sse/utils/proxyFetch.js","lineNumber":24,"sourceCode":"const proxyDispatchers = new Map();\n\n// ─── TLS fingerprinting via got-scraping (browser-like JA3) ───────────────\n// Disabled: not in use. Kept commented for future re-enable.\n// Restore the original block to re-enable per-host JA3 spoofing.\n/*\nlet _gotScraping = null;\nlet _gotScrapingChecked = false;\nconst _gotScrapingLoggedHosts = new Set();\n\nasync function getGotScraping() {\n  if (_gotScrapingChecked) return _gotScraping;\n  _gotScrapingChecked = true;\n  try {\n    const mod = await import(\"got-scraping\");\n    _gotScraping = typeof mod.gotScraping === \"function\" ? mod.gotScraping : null;\n    if (_gotScraping) dbg(\"TLS\", \"got-scraping loaded (browser-like JA3 enabled)\");\n  } catch (e) {\n    console.warn(`[ProxyFetch] got-scraping unavailable, falling back to native fetch: ${e.message}`);\n    _gotScraping = null;\n  }\n  return _gotScraping;\n}\n\nasync function gotScrapingFetch(url, options) {\n  const gs = await getGotScraping();\n  if (!gs) return null;\n\n  const method = (options.method || \"GET\").toUpperCase();\n  const headersInit = options.headers || {};\n  const headers = headersInit instanceof Headers\n    ? Object.fromEntries(headersInit.entries())\n    : { ...headersInit };\n\n  return new Promise((resolve, reject) => {\n    let settled = false;\n    const stream = gs.stream({","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/open-sse/utils/proxyFetch.js#L6-L42","documentation":"proxyFetch optionally loads got-scraping for browser-like TLS/JA3 fingerprints to defeat TLS-based bot detection. This lazy import is wrapped in try/catch; when the module can't be imported (not installed, install failure, unsupported platform), it warns once and falls back to native fetch. Requests still work but may be blocked by TLS-fingerprinting providers.","triggerScenarios":"Dynamic import('got-scraping') throws — the optional dependency was never installed, a broken native/ESM install, bundler stripped the dynamic import, or the runtime can't resolve it (Node version/ESM interop issue).","commonSituations":"Ran npm install with --omit=optional; got-scraping native build failed on the platform; running inside a minimal Docker image or bundled serverless package without the module; older Node without ESM support for the package.","solutions":["Install the optional dependency: npm i got-scraping (or reinstall without --omit=optional)","Confirm the deploy artifact actually includes node_modules/got-scraping","If TLS fingerprinting isn't needed, ignore this warning — native fetch is used automatically","Pin a Node version compatible with got-scraping (>=16) if import fails on old runtimes","For providers that block non-browser TLS, keep got-scraping installed or route through a proxy that rewrites TLS"],"exampleFix":"// before: optional deps skipped\nnpm install --omit=optional\n// after\nnpm install  # includes optionalDependencies: got-scraping","handlingStrategy":"fallback","validationCode":"let hasGotScraping = false;\ntry { await import('got-scraping'); hasGotScraping = true; }\ncatch { console.warn('got-scraping missing — TLS fingerprinting disabled'); }","typeGuard":"const tlsImpersonationAvailable = () => hasGotScraping === true;\nif (!tlsImpersonationAvailable()) console.info('native fetch will be used');","tryCatchPattern":"try {\n  return await proxyAwareFetch(url, { impersonate: true });\n} catch (e) {\n  if (/got-scraping unavailable/i.test(e.message)) {\n    return fetch(url); // degrade to native fetch\n  }\n  throw e;\n}","preventionTips":["Install optional deps in production images: npm ci (don't omit optionalDependencies)","Verify got-scraping presence in Docker/serverless bundles","Use a Node version supported by got-scraping","If providers enforce TLS fingerprints, alert when this fallback fires"],"tags":["proxy","tls","got-scraping","optional-dependency","fallback"],"backgroundTag":"optional-dependency-missing","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}