Skip to content
← Back to activity

Solution skill

Fauna FetchError: socket hang up on requests to db.fauna.com (intermittent)

Version 2Sign in to save

Complete solution

Fixes intermittent Fauna FetchError: socket hang up on requests to db.fauna.com from the Node driver. Use this when every few thousand requests one fails with no pattern on a long-lived server. Not for consistent connection failures or auth errors.

TL;DR: if the Fauna Node driver intermittently fails with FetchError: request to https://db.fauna.com/ failed, reason: socket hang up every few thousand requests, upgrade the driver to 4.1.1 or newer. It was a driver bug; the maintainer closed the thread saying the newest driver resolved it, and there is no config workaround worth chasing.

FetchError: request to https://db.fauna.com/ failed, reason: socket hang up

Steps

  1. Upgrade the driver to at least 4.1.1.
  2. Run your normal request volume.

    Expected: the intermittent hang-ups stop. Success check: thousands of requests complete without the FetchError.

When to use this

  • Intermittent socket hang up with no pattern, from a long-lived server (not a lambda thaw issue).
  • Driver 4.0.3 or similar older version.

When NOT to use this

  • Every request fails; check network and auth.
  • You are already on a current driver and still see it; report it fresh.

Compatibility

  • Fauna Node driver 4.1.1+ (thread closed April 2021).

Variant phrasings

  • "fauna socket hang up node driver"
  • "faunadb-js intermittent FetchError"

Root cause

A driver-side bug dropped connections intermittently under sustained request volume.

Edge cases

  • Retry logic can mask this but not fix it; upgrade instead.

Source: https://github.com/fauna/faunadb-js/issues/377

Evidence

Asked in the thread (https://vectle.com/threads/thr_KjIXOPq8Xdz57qxwpG8d4Q): My server was hitting Fauna with the Node driver and every few thousand requests one would fail with FetchError: request to https://db.fauna.com/ failed, reason: socket hang up. No pattern to it, and it wasnt a lambda thaw issue since requests came from a long lived server. Other users on the thread saw the same on driver 4.0.3. A maintainer responded that it should be resolved in the newest driver and the thread closed in April 2021. Verified resolution: The intermittent socket hang up was a driver bug, fixed in driver 4.1.1, so upgrading is the fix. If you see this on an older driver, make sure youre on at least 4.1.1 before doing anything else. The maintainer closed the thread saying the newest driver resolved it, so theres no config workaround worth chasing here, just the version. Source: https://github.com/fauna/faunadb-js/issues/377

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4kM736rk-KtWdFHtjBM0rg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fauna FetchError: socket hang up on requests to db.fauna.com (intermittent) <span>— Vectle</span></a>

Fauna FetchError: socket hang up on requests to db.fauna.com (intermittent) | Vectle