noblox / noblox.js

A Node.js API wrapper for Roblox.
https://noblox.js.org
MIT License
246 stars 139 forks source link

[BUG] Socket hang up error when using the onWallPost event #429

Closed brandon-005 closed 2 years ago

brandon-005 commented 3 years ago

Describe the bug This issue is regarding the "socket hang up" error that's floated around on several occasions when people use the onWallPost event. This issue has been present for a while, and I'm hoping this will help bring it to a close at last.

First and foremost, from my experimenting with this, it appears to be completely random as to when it happens, but typically I can have it happen a few times within about 5 minutes.

A few other things to note are that after some back and forth with some other people, it can also be dependent on internet speeds (which I by no means have slow internet, so I'm not sure on that one).

Handling this through the on error event only catches the SubError, rather than both. So at the moment from my knowledge, it's also not feasible to handle this manually without some extra intervention.

To Reproduce Steps to reproduce the behavior:

  1. Use noblox.js' onWallPost event
  2. Wait a random period of time and a "socket hang up" error will show.

Expected behavior The onWallPost event should function normally, and not randomly throw socket hang up errors without explanation. Handling these errors through the event should also catch this error, and not just the SubError (more about this in the additional context section).

Screenshots Basic code example: image

Error Example: image

Additional context Handling errors through the wallPost.on('error', () => {}) event will only handle the SubError and not the socket hang up, the SubError will appear after the initial socket hang up error.

Example of this: image

brandon-005 commented 2 years ago

Going to bump this issue since it's been over 2 weeks and this issue is still present for me.

WaviestBalloon commented 2 years ago

I'm running into this issue, bumping

WaviestBalloon commented 2 years ago

Error output:

Unhandled rejection RequestError: Error: socket hang up
    at new RequestError (G:\Desktop\bot\node_modules\request-promise-core\lib\errors.js:14:15)
    at Request.plumbing.callback (G:\Desktop\bot\node_modules\request-promise-core\lib\plumbing.js:87:29)
    at Request.RP$callback [as _callback] (G:\Desktop\bot\node_modules\request-promise-core\lib\plumbing.js:46:31)
    at self.callback (G:\Desktop\bot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:400:28)
    at Request.onRequestError (G:\Desktop\bot\node_modules\request\request.js:877:8)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketCloseListener (_http_client.js:449:11)
    at TLSSocket.emit (events.js:412:35)
    at net.js:675:12
    at TCP.done (_tls_wrap.js:563:7)

Unhandled rejection TimeoutError: operation timed out
    at afterTimeout (G:\Desktop\bot\node_modules\bluebird\js\release\timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (G:\Desktop\bot\node_modules\bluebird\js\release\timers.js:76:13)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)

Code being used:

const noblox = require('noblox.js')
async function startApp () {
    // You MUST call setCookie() before using any authenticated methods [marked by 🔐]
    // Replace the parameter in setCookie() with your .ROBLOSECURITY cookie.
    const currentUser = await noblox.setCookie('_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_') 
    console.log(`Logged in as ${currentUser.UserName} [${currentUser.UserID}]`)

    // Do everything else, calling functions and the like.
    const groupInfo = await noblox.getGroup(9997719)
    console.log(groupInfo)
}
startApp()

noblox.onWallPost(9997719).on("data", function(data) {
    console.log("New post!", data)
})
Amauryeen commented 2 years ago

Having the same exact error with the onAuditLog() event.