tiagosiebler / bybit-api

Node.js SDK for the Bybit APIs and WebSockets, with TypeScript & browser support.

Home Page:https://www.npmjs.com/package/bybit-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "(orderbook.50.BTCUSDT,greek) failed to subscribe".] { code: 'ERR_UNHANDLED_REJECTION' }

minyongcode opened this issue · comments

When does this happen? When calling the subscribeV5 function on the websocket client?

Can you provide an example of what parameters you sent when you called this and saw this error? You should probably wrap that function call in a try/catch block, though I'm guessing something is wrong with the parameters you've sent. Need more information here.

Since today i have the same problem. On my server it works, but on my computer i get error:

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "(order) failed to subscribe".

Code:

try {
        //wsClient.subscribe(['order']);
        wsClient.subscribeV5(['order'], 'linear');
} catch (error) {
    console.log("Fehler: " + error)
}

This happens even if IP is whitelisted or all IPs allowed...

subscribeV5 returns a promise, can you try to await wsClient.subscribeV5(['order'], 'linear');? That should give more info on what the exception was. I wonder if there's a new geo-IP ban, since it works fine on the server.

GEO IP ban must be the answer... I'm located in germany, i hope they dont ban german customers like binance...

GEO IP ban must be the answer... I'm located in germany, i hope they dont ban german customers like binance...

Does the error improve if you await the wsClient.subscribeV5 inside the/catch? It should have more info on what led to the promise rejection.

Its the same message "(order) failed to subscribe" but now the whole app doesn't crash. Also i can't get account informations with

const linearClient = new RestClientV5({

So rest api calls aren't working either for you? Can you provide a more detailed error? There should be some kind of error somewhere, probably from the REST API response. If you can provide that, I can ask my bybit contacts about it.

Now everything works again. I guess my IP had a timeout...