Bug Description
Socks5ProxyAgent ignores options.connect
Reproducible By
import net from 'node:net'
import { request, Socks5ProxyAgent } from 'undici'
let called = false
const agent = new Socks5ProxyAgent('socks5://127.0.0.1:1080', {
connect (_, cb) {
called = true
cb(new Error('custom connector used'))
}
})
await request('http://example.com', { dispatcher: agent }).catch(() => {})
await agent.close().catch(() => {})
console.log({ called })
Expected Behavior
options.connect should be called to create the connection to the SOCKS5 proxy.
Logs & Screenshots
options.connect is not called. createSocks5Connection() calls net.connect() directly.
Environment
macOS 26.4.1
Node v24.15.0
undici v8.2.0
Bug Description
Socks5ProxyAgent ignores options.connect
Reproducible By
Expected Behavior
options.connect should be called to create the connection to the SOCKS5 proxy.
Logs & Screenshots
options.connect is not called. createSocks5Connection() calls net.connect() directly.
{ called: false }Environment
macOS 26.4.1
Node v24.15.0
undici v8.2.0