Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dist/webhooks/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ function guardedLookup(allowPrivate) {
}
if (opts["all"])
return callback(null, usable);
const first = usable[0];
// One address wanted (Node 18 has no happy-eyeballs fallback): prefer IPv4, as Node did before v17,
// so "localhost" reaches a receiver bound to 127.0.0.1 instead of failing on ::1.
const first = (usable.find((a) => a.family === 4) ?? usable[0]);
return callback(null, first.address, first.family);
});
});
Expand Down
4 changes: 3 additions & 1 deletion src/webhooks/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ function guardedLookup(allowPrivate: boolean): LookupFunction {
return callback(new BlockedAddressError(`${hostname} resolves only to non-public addresses`));
}
if (opts["all"]) return callback(null, usable);
const first = usable[0] as LookupAddress;
// One address wanted (Node 18 has no happy-eyeballs fallback): prefer IPv4, as Node did before v17,
// so "localhost" reaches a receiver bound to 127.0.0.1 instead of failing on ::1.
const first = (usable.find((a) => a.family === 4) ?? usable[0]) as LookupAddress;
return callback(null, first.address, first.family);
});
}) as LookupFunction;
Expand Down
Loading