Troubleshooting
Why Node-RED HTTP requests throw AggregateError after an update
Short answer
An AggregateError from the HTTP request node wraps the runtime's failed connection attempts; it is not a diagnosis. A passing ping clears ICMP, not outbound TCP 443 or TLS. Log the nested error object, test DNS, TCP 443 and certificate trust in order from the device, and while the hop stays broken, relay the messages over MQTT to a second Node-RED host that completes the request.

On this page
After a controller or runtime update, an HTTP request node that ran for years starts failing with RequestError: AggregateError, and a ping that answers in tens of milliseconds looks like proof the network is fine. It is not the proof it seems: AggregateError is the wrapper the Node.js runtime puts around several failed connection attempts, and ping tests ICMP while the request needs outbound TCP 443 plus a TLS handshake. Log the nested errors to name the failing hop, then test DNS answers, TCP 443 and certificate trust in that order, from the device itself. In the reported case, POSTs to a chat-notification API broke after a firmware update, ran unchanged on a laptop on the same network, and survived node restarts, a full flow re-import and a fresh web server certificate on the controller. While that hop is being fixed, relay the messages over MQTT to a second Node-RED host that can complete the request.
What AggregateError actually wraps #
AggregateError is a standard JavaScript container error: it names no cause itself, it carries an errors array with one entry per failed connection attempt. Recent Node.js releases connect by trying the addresses the hostname resolved to, across address families, and when every attempt fails the runtime gathers them into a single AggregateError. The HTTP request node surfaces that as RequestError: AggregateError, and the stack the controller logged descends through the request library's request-promise-core plumbing and ends at the TLS socket error listener TLSSocket.socketErrorListener: below any HTTP response, at the connection or handshake layer. The same signature shows in the telegram bot node's issue tracker as EFATAL: AggregateError on Node-RED 4.0.2 with Node.js v20.17.0, so this is runtime-generation behavior, not a miswired flow.
The debug pane shows only the message, so make the nested object visible: send the error to a debug node set to show the complete message, or print it from a function node. Read per attempt: the nested code (connection refused, connection timed out, no route, network unreachable), the address and port tried, the address family and, where TCP opened, the certificate text instead. The same fault often lands in the runtime log as an unhandled rejection too; that log copy is usually the fuller record, which is why Node-RED's error-handling guide separates flow-routable errors from uncaught ones.
Why a passing ping proves so little #
An echo reply proves ICMP reachability to the one address the resolver handed to ping, and nothing else. The HTTPS request needs three further hops echo never touches: the resolver must return working addresses, TCP must open on port 443, and the handshake must validate the remote certificate against the local trust store. Firewalls allow echo while filtering TCP; cloud endpoints drop echo while serving TCP; and a hostname resolving to several addresses can answer a ping on one while the runtime fails on every address it tries. An update can change any link in that chain without touching the firewall, because resolver configuration, address-family preference, the Node.js build and its CA trust store all ship inside the platform image. Run the tests on the device, as the reported case did from an exec node: a laptop on the same network proves the laptop's path, not the controller's.
Test the hops in this order #
Work from the bottom of the stack up, on the controller itself, and record what each hop returns before changing any setting.
- Confirm the controller's own network settings — link state, address, mask, gateway, resolver — against the pre-update values or against a laptop on the same network. The restarts, re-imports and certificate swaps already tried change none of these.
- Resolve the API hostname on the controller and write down every address returned, not just the first. If Node-RED runs inside a container, the container resolves with its own configuration, and container resolver faults surface as answers such as SERVFAIL that a host-level test misses; container DNS resolution failures that end in SERVFAIL covers that diagnosis.
- From the controller, attempt a TCP connection on port 443 to each address in turn. Per-address refused, timed out or no-route results are exactly the entries AggregateError collects, and they tell you which address family fails.
- When TCP opens, read the TLS result next. Certificate text naming an expired certificate has the documented renewal path for Node-RED in Docker on an edge PC, and other certificate text points to a missing chain in the runtime's trust store.
- Re-run the request with the complete error object visible and match each nested code to its hop: refused or timed out means outbound TCP filtering, no route or network unreachable means addressing or family selection, certificate text means expiry or trust, and a handshake alert means protocol or cipher negotiation on the controller's Node.js build.
Working the hops on the controller that pings 1.1.1.1 in 25 ms #
The reported case gives enough measurements to work the decision end to end. Inputs, all taken on the devices in that case:
- Ping to 1.1.1.1 from the controller: reply in 25 ms, normal for that network.
- Ping to www.google.com from the same device: about 32 ms.
- Ping to api.telegram.org by name, from the controller's exec node: replies, with a latency spike far above the reference round trips; no figure was reported.
- The same flow copied to a laptop: delivered normally. Node.js versions identical, Node-RED 4.0.9 there against 4.0.2 on the controller, and holding the laptop at the controller's exact combination still worked.
The rule, in words: an echo reply proves ICMP reachability to the tested address only. A second reference destination turns a single ping into a baseline — when two independent reference round trips sit within a few milliseconds of each other, the default route and the general internet path are healthy. A destination that answers echo but far above that baseline points to a path or filtering symptom on that destination's route, and it leaves TCP establishment and certificate validation as the only untested hops, precisely the hops an AggregateError reports.
The arithmetic: 32 ms - 25 ms = 7 ms between the two reference destinations, so the healthy baseline on this network sits at roughly 25–32 ms. The API host's spike arrived without a figure, so it counts as far above baseline rather than as data.
The result: name resolution works, because the by-name ping resolved and reached the API host; ICMP reaches both references and the destination; the default route and general connectivity are proven. DNS, IP routing and ICMP are cleared. TCP 443 from the controller and the TLS handshake remain untested, and they are the only hops left.
The decision, with its threshold: once two reference destinations answer within tens of milliseconds, stop spending time on connectivity tests and treat the controller's TCP 443 or TLS path as the fault. Put delivery on the MQTT relay immediately when notifications matter to operations, and keep the TCP and certificate tests running from the device as a separate maintenance task. The laptop result adds the platform conclusion: identical versions did not reproduce the failure, so the difference lives in the controller's environment — resolver, trust store, firmware network stack — not in the flow or the Node-RED release.
Relay the messages over MQTT while the HTTPS hop stays broken #
The relay splits one blocked transaction into two testable ones: controller to broker, then second host to the API. Keep the event logic and message building on the controller, publish to a dedicated notification topic on the site broker, and let a second Node-RED host subscribe and perform the POST, holding the bot token on that host only. This is the arrangement the reported case adopted, and it runs on hops the controller has already proven: if the controller reaches the broker, delivery resumes even while its outbound HTTPS stays blocked.
If the broker link or the second host can drop out, buffer the notifications at the publisher; buffering MQTT data in Node-RED during an internet outage covers the store-and-forward setup. Add an event identifier to each payload and suppress repeats after reconnects, because at-least-once broker delivery can duplicate notifications. If the POSTs carry alarm notifications, treat the relay as safety-relevant delivery and alert on broker disconnection and on the second host failing to publish, so an alarm never dies silently in a queue.
The second host is an always-on plant computer rather than a spare workstation; a fanless industrial mini PC mounted in the cabinet beside the controller fits the role and keeps the relay inside the same panel.
The decision for each case #
| Nested evidence or situation | Decision |
|---|---|
| Every attempt refused or timed out on 443 | Outbound TCP filtering or a wrong route: correct the firewall rule or route, prove it from the controller, and keep the relay running until then. |
| No route or network unreachable, one address family failing | Family selection or addressing: fix the addresses or make the resolver return a reachable family; the relay covers delivery meanwhile. |
| Certificate text in the nested errors | Renew the certificate or complete the chain in the runtime's trust store; never disable verification to force the request through. |
| Reference pings healthy, identical versions work on a laptop | Platform-environment fault after the update: run the relay as the standing delivery path and chase the resolver and trust store on the controller as maintenance. |
| Controller resolver answers differ from a public resolver | Repair the resolver, and resist hard-coding the address: the certificate binds to the hostname and service addresses move. |
Whichever row matches, the evidence is the nested error object, never the AggregateError label: collect it first, and let the relay keep the messages moving while the failing hop gets repaired.
Questions asked
Why does the same flow work on a laptop but fail on the edge controller?
The flow is only part of the runtime. The controller brings its own resolver, CA trust store, address-family behavior and the firmware-supplied Node.js build. In the reported case the Node.js versions matched, and a laptop held at the controller's exact Node-RED and Node.js combination still delivered every message, which leaves the controller's platform environment, not the flow or one release number, as the difference.
Can I put the API host's IP address in the URL instead of the hostname?
As a one-off test it separates a resolver fault from a reachability fault, because the request then skips name resolution. As a permanent setting it is wrong: the TLS certificate is issued to the hostname, so verification fails or has to be bypassed, and cloud service addresses change without notice. Keep the hostname and repair the resolver or the route.
Does replacing the controller's web server certificate fix the outbound failure?
No. That certificate identifies the controller to inbound clients such as the editor and its web interface. An outbound HTTPS request validates the remote API against the controller's CA trust store, a different store with a different job. In the reported case issuing a new web server certificate changed nothing, which is exactly what the two roles predict.
Is switching to the dedicated Telegram node a better fix than the HTTP request node?
It is worth doing for maintainability, but it is not a fix for this fault: the node still opens the same HTTPS connection from the same runtime, resolver and trust store, so a socket-level or certificate-level failure reproduces through it. Where the controller's outbound path stays broken, the MQTT relay to a second host is the change that actually removes the failing hop.
How do I read the real cause out of an AggregateError?
Log the complete error object, not its message. AggregateError carries an errors array with one entry per attempted address, and each entry names its own code, address, port and address family. Refused or timed out points at filtering of the HTTPS port; no route or network unreachable points at addressing or family selection; certificate text points at expiry or a missing chain in the trust store.

