software by Stafford Williams stafford williams
home blogdevlognoteslinkstalksappsabout

2025-03-25 9:49pm

node, spacetraders-v2

Burnt a couple of nights chasing this one. Node was throwing ETIMEDOUT AggregateError when hitting https://api.spacetraders.io/v2 even though curl to the same address had no issue. Turns out node attempts resolve ipv6 first, and in the case of SpaceTraders API ipv6 can be resolved but the API doesn’t support it, however, the resolution time goes over 250ms from Australia to wherever it’s hosted, throwing ETIMEDOUT. The solution is to:

js
net.setDefaultAutoSelectFamilyAttemptTimeout(500)
  • If this was helpful, please share:

  • software by Stafford Williams
about