Skip to content
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

fix: allow to pass null and undefined as httpProxy #509

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Noobgam
Copy link

@Noobgam Noobgam commented Dec 29, 2024

Very minor (but a bit annoying) thing.

    this.client = new SteamUser({
           httpProxy: config.proxyConfiguration
        });

fails because it renders http:// as a url to proxy

whoever maintains @types/steam-user (know it's not you), says nulls should work, but they also don't.
That patch should do the trick

@DoctorMcKay
Copy link
Owner

What is the value of config.proxyConfiguration in your example?

@Noobgam
Copy link
Author

Noobgam commented Dec 29, 2024

Nevermind, I'm delusional. I passed an empty string. Undefined works as well, it won't pass the typeof undefined == 'string' part.

What is the value of config.proxyConfiguration in your example?

But I think the patch could still be useful to someone, because the errors thrown by steamuser are barely visible in logs.
You get the debug of sorts (I'm logging them with pino)

GetCMListForConnect error: Invalid URL"
Waiting for the debugger to disconnect...
node:internal/url:818
      href = bindingUrl.parse(input, base, true);
                        ^

TypeError: Invalid URL
    at new URL (node:internal/url:818:25)
    at agent.createConnection (\code\node_modules\@doctormckay\stdlib\lib\http\proxyagent.js:20:19)
    at Agent.createSocket (node:_http_agent:324:26)
    at Agent.addRequest (node:_http_agent:276:10)
    at new ClientRequest (node:_http_client:341:16)
    at request (node:https:381:10)
    at \code\node_modules\@doctormckay\stdlib\lib\http\client\HttpClient.js:69:23
    at \code\node_modules\@doctormckay\stdlib\lib\promises\timeoutPromise.js:23:34
    at new Promise (<anonymous>)
    at timeoutPromise (\code\node_modules\@doctormckay\stdlib\lib\promises\timeoutPromise.js:13:12)
Emitted 'error' event on SteamUser instance at:
    at SteamUser._doConnection (\code\node_modules\steam-user\components\09-logon.js:314:10) {

Which doesn't exactly tell much.
But feel free to close the PR if you think this is intended behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants