jeffbski / jeffbski/wait-on

Error when using waitOn() with IPv6 address

Open
#141 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm wondering if wait-on does not support ipv6, because I got an error when I tried to use it with an ipv6 address. Here are the details:

I opened an ipv6 address: [::1]:4200, but when I run the code:
```
waitOn({
resources: ["tcp:[::1]:4200"],
delay: 1000,
interval: 100,
simultaneous: 1,
timeout: 3000,
tcpTimeout: 1000,
window: 1000,
strictSSL: false,
verbose: false,
})
```
I got an error with message:
```
wait-on(18440) exiting with error TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
at tcpExists (C:\myTsProject\node_modules\wait-on\lib\wait-on.js:342:61)
```
But when I use psping or browser, "[::1]:4200" can be connected.

I find the code in line 342 of wait-on.js is:
```
const [, , /* full, hostWithColon */ hostMatched, port] = HOST_PORT_RE.exec(tcpPath);
```
Where
```
const HOST_PORT_RE = /^(([^:]*):)?(\d+)$/;
```
and tcpPath in my case maybe "tcp:[::1]:4200" or "[::1]:4200", both of them indeed do not match this regular expression.

Some additional information:
- Node.js version: 18.16
- wait-on version: 6.0.1
- OS: Windows 11

Thank you for your help. I appreciate your work on this library.

Contributor guide

No contributing guide indexed for this repository

Research direction

The failure is in lib/wait-on.js at line 342, where tcpExists parses tcpPath with HOST_PORT_RE. Start by reproducing the reported waitOn call with tcp:[::1]:4200 and inspect that parser; done means an IPv6 resource no longer throws and can be detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.