Jump to content
McKay Development

onPreHttpRequest Error Catching

Recommended Posts

Hey, I am trying to use a proxy and use different ones for different tasks, which I originally had working, but today I encountered an error with it throwing an "tunneling socket could not be established, statusCode=407", only issue is I don't know exactly where to catch this error as I tried to get it on the onPreHttpRequest, but even with that the entire nodejs process crashed, and I can't really have that occur in production.

Proxy was showing as "http://user:pass@ip:port"

          this.community.onPreHttpRequest = (id, source, options, contReq) => { 
            try {
              if (options.uri.includes('/inventory/') && options.uri.includes('/252490/2')) { options.proxy = this.invProxies.getProxy() }
              else if (source === 'steamcommunity') { options.proxy = this.communityProxy }
              else if (source === 'tradeoffermanager') { options.proxy = this.managerProxy }
              return true
            } catch (e) {

Thanks in advance.

Edited by christianwdev
Link to comment
Share on other sites

10 hours ago, Dr. McKay said:

407 means that your proxy credentials are wrong.


Hey, I figured it was something with my proxy not working, but my concern at this point is less about the proxy working, and more about trying to catch the error to prevent the entire backend from crashing as it seems my proxy service decides to randomly invalidate my credentials. Just wasn't sure where I can try catch this or if it's even something that I can do.

Thanks again.

Edited by christianwdev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...