-
-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing code property on error #1865
Comments
Can you please fill in the issue template properly? How to reproduce this? |
Using node 14.17.4, got 11.8.1 and socks-proxy-agent 5.0.0. When using a proxy the timeout isn't used, and const got = require("got")
const { SocksProxyAgent } = require("socks-proxy-agent")
// Error right away ("ETIMEDOUT", "Timeout awaiting "request" for 1ms")
got("https://github.com", { retry: 0, timeout: 1 })
.catch(e => console.log(e.code, e.message))
// Error after 30 seconds ("undefined", "Proxy connection timed out")
got("https://github.com", { retry: 0, timeout: 1, agent: { https: new SocksProxyAgent("socks5://127:0.0.1:123") } })
.catch(e => console.log(e.code, e.message)) There are other inconsistencies with using a proxy or not. For example using a wrong domain (github.comm) // Error right away ("ETIMEDOUT", "Timeout awaiting "request" for 1ms")
got("https://github.comm", { retry: 0, timeout: 1 })
.catch(e => console.log(e.code, e.message))
// Error right away ("ENOTFOUND", "getaddrinfo ENOTFOUND github.comm")
got("https://github.comm", { retry: 0, timeout: 1, agent: { https: new SocksProxyAgent("socks5://127:0.0.1:123") } })
.catch(e => console.log(e.code, e.message)) With no timeout they are the same // Error right away ("ENOTFOUND", "getaddrinfo ENOTFOUND github.comm")
got("https://github.comm", { retry: 0 })
.catch(e => console.log(e.code, e.message))
// Error right away ("ENOTFOUND", "getaddrinfo ENOTFOUND github.comm")
got("https://github.comm", { retry: 0, agent: { https: new SocksProxyAgent("socks5://127:0.0.1:123") } })
.catch(e => console.log(e.code, e.message)) |
The most probable thing is that the upstream error doesn't have |
Tried 12.0.0-beta.4 but same behavior. Shouldn't the timeout be used even if we're using a proxy? And same error messages with and without proxy? |
Agents may implement their own timeouts, which aren't compatible with Got.
Unfortunately without reproducible code we can't do much :( |
Since Is there any way to get access to the underlying Error object thrown by the Agent? Could something like a |
The socket belongs to Agent, Got doesn't control it, so no. |
|
|
I am facing the same issue, any error that got returns are sent without the code property. |
@Koyamie any reproducible code please? |
It has been fixed in a recent commit, can't tell which but I am no longer facing this issue. |
@szmarczak Could you add a property on the |
Can you open another issue please? |
@szmarczak Can you please open this issue? I don't know why @Koyamie thinks this is fixed in a recent commit. Reproducible code for one of the cases is #1865 (comment). Don't know how to reproduce ECONNREFUSED. More examples
|
I'm getting no
code
property on the error.error.code
isundefined
but it is agot
Error becauseerror instanceof RequestError
is true. Could it be because ofsocksclient.js
?How can I get access to
error.code
which should beECONNREFUSED
here?The text was updated successfully, but these errors were encountered: