{"record":{"id":"a3e73b49a19a1a7c","repo":"jackwener/OpenCLI","slug":"network-error-fetching-signed-url-e-message","errorCode":null,"errorMessage":"network error fetching signed URL: ${e.message}","messagePattern":"network error fetching signed URL: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/slock/attachment-download.js","lineNumber":64,"sourceCode":"    await page.goto(SLOCK_HOME_URL);\n    const snippet = buildFetchSnippet({\n      method: 'GET',\n      path: `/attachments/${encodeURIComponent(id)}/url`,\n      serverScoped: true,\n      serverIdOverride: kwargs.server,\n    });\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const rows = dispatchEvaluateResult(result);\n    const data = Array.isArray(rows) ? rows[0] : rows;\n    const url = data?.url;\n    if (!url) throw new CommandExecutionError(`no signed url returned for attachment ${id}`);\n\n    // Step 2 — Node side, fetch the bytes from the signed CDN URL. No auth\n    // header (URL is pre-signed); no Origin (Node fetch has none) so CORS\n    // isn't in play.\n    let res;\n    try { res = await fetch(url); }\n    catch (e) { throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`); }\n    if (!res.ok) {\n      throw new CommandExecutionError(`HTTP ${res.status} from signed CDN URL while downloading ${id}`);\n    }\n    const ab = await res.arrayBuffer();\n    fs.writeFileSync(out, Buffer.from(ab));\n    return [{ attachmentId: id, out, sizeBytes: ab.byteLength }];\n  },\n});\n","sourceCodeStart":46,"sourceCodeEnd":73,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/attachment-download.js#L46-L73","documentation":"A CommandExecutionError thrown when Node's fetch of the pre-signed CDN URL rejects (network-level failure, not an HTTP error status). Because the URL is pre-signed, no auth headers are needed; a rejection means DNS, TLS, connectivity, or an invalid/unfetchable URL rather than a 4xx/5xx response.","triggerScenarios":"The fetch(url) call throws — machine offline or behind a proxy blocking the CDN host, DNS resolution failure for the CDN domain, TLS certificate issues, IPv6 connectivity problems, or the signed URL being malformed (e.g. contains characters fetch cannot parse).","commonSituations":"Corporate proxy/firewall blocking the storage CDN domain; VPN or DNS misconfiguration; expired signed URL is not the cause here (that yields HTTP 403, caught by the res.ok branch); Node without network access in a container/sandbox.","solutions":["Check basic network connectivity to the CDN host (curl the signed URL from the same machine)","Fix proxy environment variables (HTTPS_PROXY/NO_PROXY) or corporate firewall rules for the CDN domain","Retry — transient DNS or TLS failures often resolve on a second attempt","Verify the signed URL is well-formed by logging it before fetching"],"exampleFix":"// before\ncatch (e) { throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`); }\n// after\ncatch (e) {\n  if (e instanceof Error && e.message.includes('fetch failed')) {\n    // hint: proxy/DNS — check connectivity to CDN host\n  }\n  throw new CommandExecutionError(`network error fetching signed URL: ${e.message}`);\n}","handlingStrategy":"retry","validationCode":"// reachability pre-check\ntry {\n  await fetch('https://example-cdn.invalid/ping', { method: 'HEAD', signal: AbortSignal.timeout(5000) });\n} catch { console.error('CDN host unreachable — check network/proxy/DNS'); }","typeGuard":null,"tryCatchPattern":"try {\n  await attachmentDownload(page, { attachmentId: id });\n} catch (e) {\n  if (/network error fetching signed URL/.test(e.message)) {\n    await new Promise(r => setTimeout(r, 2000));\n    return attachmentDownload(page, { attachmentId: id }); // one retry for transient DNS/TLS failures\n  }\n  throw e;\n}","preventionTips":["Configure HTTPS_PROXY/NO_PROXY so Node fetch can reach the storage CDN","Retry with backoff for transient DNS/TLS failures","Log the signed URL to confirm it is well-formed before fetching","Run connectivity smoke tests (curl/HEAD) in CI before download jobs"],"tags":["network","http","fetch","dns"],"backgroundTag":"fetch-network-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}