Skip to content

Fix: IPv6 fetch connect timeout in Node.js 18+ by defaulting to IPv4 first #2696

Description

@raja-nagabonar

I encountered a fetch connect timeout error (took around 249021ms) when the server attempted to proxy a request. This is caused by a known issue in Node 18/20's undici fetch implementation when trying to establish IPv6 connections that drop silently.

Adding --dns-result-order=ipv4first to the spawned Node processes (for the server and the tray) in cli.js completely resolves the issue, forcing it to fall back properly to IPv4.

Stack Trace:

[20:03:28] 🟡 ✗ ERROR 502 · nvidia/z-ai/glm-5.2 · 249021ms [502]: fetch connect timeout Error: fetch connect timeout at node:internal/deps/undici/undici:14976:13

Fix:
In cli.js, simply append --dns-result-order=ipv4first to the spawn arguments where serverPath and the tray background process are launched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions