{"record":{"id":"7330862a896d8f49","repo":"hcengineering/platform","slug":"platform-status-connectionclosed-733086","errorCode":"platform.status.ConnectionClosed","errorMessage":"Network error occurred","messagePattern":"Network error occurred","errorType":"error_code","errorClass":"PlatformError","httpStatus":null,"severity":"error","filePath":"packages/integration-client/src/request.ts","lineNumber":53,"sourceCode":" *\n * @param options - Request configuration options\n * @returns Promise that resolves to the parsed JSON response, or undefined for empty responses\n * @throws {PlatformError} When network errors occur or HTTP status indicates failure\n */\nexport async function request (options: RequestOptions): Promise<any> {\n  const { baseUrl, method, path, token, body } = options\n  let response: Response\n  try {\n    response = await fetch(concatLink(baseUrl, path ?? ''), {\n      method,\n      headers: {\n        ...(token !== undefined ? { Authorization: 'Bearer ' + token } : {}),\n        'Content-Type': 'application/json'\n      },\n      ...(body !== undefined ? { body: JSON.stringify(body) } : {})\n    })\n  } catch (err) {\n    throw new PlatformError(\n      new Status(Severity.ERROR, platform.status.ConnectionClosed, {\n        message: 'Network error occurred'\n      })\n    )\n  }\n\n  if (response.status === 200) {\n    const contentLength = response.headers.get('content-length')\n    const contentType = response.headers.get('content-type') ?? ''\n\n    if (contentLength === '0' || (!contentType.includes('application/json') && !contentType.includes('text/json'))) {\n      return undefined\n    }\n\n    const text = await response.text()\n    if (text.trim() === '') {\n      return undefined\n    }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/integration-client/src/request.ts#L35-L71","documentation":"The integration client wraps every underlying fetch failure (DNS failure, connection refused/reset, timeout, TLS error) into a PlatformError with status.ConnectionClosed. The original error is discarded, so this message always means 'the HTTP request never got a response'.","triggerScenarios":"Any request() call where fetch throws — service unreachable, connection reset mid-request, DNS resolution failure, or CORS/network failure in the browser.","commonSituations":"Integration service not running or wrong base URL; service restarted during a deploy; corporate proxy or firewall blocking the request; offline client.","solutions":["Check the service's base URL/port and that the integration service is running and reachable.","Retry the request — transient resets are common; add exponential backoff.","Verify DNS/network path (proxy, firewall, VPN) between client and service.","If reproducible, capture the underlying cause by temporarily logging err before it is wrapped."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"import { PlatformError, platform } from '@hcengineering/platform'\ntry {\n  await client.request(...)\n} catch (err) {\n  if (err instanceof PlatformError && err.status.code === platform.status.ConnectionClosed) {\n    await retryWithBackoff(() => client.request(...), { retries: 3 })\n  } else {\n    throw err\n  }\n}","preventionTips":["Verify base URL and port in client configuration during setup.","Add retry with exponential backoff for all integration-client calls.","Monitor service availability and alert before users hit the error.","In tests, use well-known ports and avoid hardcoding service locations."],"tags":["network","fetch","connection"],"backgroundTag":"connection-refused","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}