hcengineering/platform · error · PlatformError

platform.status.ConnectionClosed

platform.status.ConnectionClosed

Error message

Network error occurred

What it means

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'.

Source

Thrown at packages/integration-client/src/request.ts:53

 *
 * @param options - Request configuration options
 * @returns Promise that resolves to the parsed JSON response, or undefined for empty responses
 * @throws {PlatformError} When network errors occur or HTTP status indicates failure
 */
export async function request (options: RequestOptions): Promise<any> {
  const { baseUrl, method, path, token, body } = options
  let response: Response
  try {
    response = await fetch(concatLink(baseUrl, path ?? ''), {
      method,
      headers: {
        ...(token !== undefined ? { Authorization: 'Bearer ' + token } : {}),
        'Content-Type': 'application/json'
      },
      ...(body !== undefined ? { body: JSON.stringify(body) } : {})
    })
  } catch (err) {
    throw new PlatformError(
      new Status(Severity.ERROR, platform.status.ConnectionClosed, {
        message: 'Network error occurred'
      })
    )
  }

  if (response.status === 200) {
    const contentLength = response.headers.get('content-length')
    const contentType = response.headers.get('content-type') ?? ''

    if (contentLength === '0' || (!contentType.includes('application/json') && !contentType.includes('text/json'))) {
      return undefined
    }

    const text = await response.text()
    if (text.trim() === '') {
      return undefined
    }

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Check the service's base URL/port and that the integration service is running and reachable.
  2. Retry the request — transient resets are common; add exponential backoff.
  3. Verify DNS/network path (proxy, firewall, VPN) between client and service.
  4. If reproducible, capture the underlying cause by temporarily logging err before it is wrapped.
Defensive patterns

Strategy: retry

Try / catch

import { PlatformError, platform } from '@hcengineering/platform'
try {
  await client.request(...)
} catch (err) {
  if (err instanceof PlatformError && err.status.code === platform.status.ConnectionClosed) {
    await retryWithBackoff(() => client.request(...), { retries: 3 })
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Any request() call where fetch throws — service unreachable, connection reset mid-request, DNS resolution failure, or CORS/network failure in the browser.

Common situations: Integration service not running or wrong base URL; service restarted during a deploy; corporate proxy or firewall blocking the request; offline client.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/7330862a896d8f49. Report an issue: GitHub.