steem-js
steem-js copied to clipboard
"Unhandled rejection Error: not opened" when using steem.broadcast.vote
Expected behavior
I have a very small app that basically votes and then unvotes : https://github.com/drov0/Nopebot
It works well, but if I let it run for some time (30-40minutes) then I get an error when I try to call steem.broadcast.vote
Actual behavior
I get exactly this error :
0|main | Unhandled rejection Error: not opened 0|main | at WebSocket.send (/root/Nopebot/node_modules/ws/lib/WebSocket.js:344:18) 0|main | at /root/Nopebot/node_modules/steem/lib/api/transports/ws.js:135:19 0|main | at tryCatcher (/root/Nopebot/node_modules/bluebird/js/release/util.js:16:23) 0|main | at Promise._settlePromiseFromHandler (/root/Nopebot/node_modules/bluebird/js/release/promise.js:512:31) 0|main | at Promise._settlePromise (/root/Nopebot/node_modules/bluebird/js/release/promise.js:569:18) 0|main | at Promise._settlePromiseCtx (/root/Nopebot/node_modules/bluebird/js/release/promise.js:606:10) 0|main | at Async._drainQueue (/root/Nopebot/node_modules/bluebird/js/release/async.js:138:12) 0|main | at Async._drainQueues (/root/Nopebot/node_modules/bluebird/js/release/async.js:143:10) 0|main | at Immediate.Async.drainQueues [as _onImmediate] (/root/Nopebot/node_modules/bluebird/js/release/async.js:17:14) 0|main | at processImmediate [as _immediateCallback] (timers.js:383:17)
How to reproduce
run the code https://github.com/drov0/Nopebot, just put a few steemit articles urls in the form (validate the form a few time), then wait for some time (30-40 minutes) and try to submit another article to the form
Environment information
ubuntu 16.04 nodejs v4.2.6
It might be a problem with the default Steem WebSocket. Try putting this line before you do anything on the Steem network.
steem.api.setOptions({ url: 'wss://node.steem.ws' });
Mmmh interesting idea.
Problem is it does not recognizes the other nodes :
wss://node.steem.ws : getaddrinfo ENOTFOUND node.steem.ws node.steem.ws:443 wss://this.piston.rocks : Hostname/IP doesn't match certificate's altnames: "Host: this.piston.rocks. is not in the cert's altnames: DNS:steemit.com, DNS:*.steemit.com"
Same problem
Take a different websocket.
const steem = require('steem'); steem.api.setOptions({ url: 'wss://steemd-int.steemit.com' });
Will try tonight, thanks.
Same problem(s) when using steem.api.getAccounts
.
For 'wss://node.steem.ws' and wss://this.piston.rocks I encounter the same as drov0 above
I received a normal response from the default socket and from 'wss://steemd-int.steemit.com' at first. After about 10 minutes I see this...
Unhandled rejection Error: not opened at WebSocket.send
I'm using node v7.9.0 on Ubuntu 14.04.3 LTS. Have tried steem-js ver 0.6.7 and 0.6.10 with the same result.
Getting the same problem with the default websocket
In my case it seemed to be a problem with timeout or interruption of the websocket. To make sure it's open and ok I explicitly set the options to the default immediately before calling getAccounts (or broadcast vote, etc)...
steem.api.setOptions({ url: 'wss://steemd.steemit.com' });
steem.api.getAccounts(["ned","null"], function(err, response) {
if (!err) {
//render
} else {
//do some err handling
}
});
Got the error to stop. Not sure whether there's a downside.
@tdreid the endpoint wss://steemd.steemit.com
is not being maintained anymore see related post:
https://steemit.com/steemitdev/@steemitdev/last-chance-to-update-steemd-steemit-com-will-be-retired-on-january-6
You should use this endpoint instead https://api.steemit.com
.
Guys use this websocket wss://steemd-int.steemit.com The other ones are having troubles and this one i use for my projects and its stable.
@bonustrack Thanks! This seems to be the correct solution, i would not use wss://steemd-int.steemit.com
either anymore.
@bonustrack Yes I can confirm as well that wss://steemd-int.steemit.com has issues.
I will try the https://api.steemit.com endpoint and I have no issues for a week I'll close the issue :)
Update : The bug still appears, less often but still does.
Trying to do anything in the API I get the error:
Unhandled rejection Error: getaddrinfo ENOTFOUND steemd.steemit.com steemd.steemit.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
Unhandled rejection Error: getaddrinfo ENOTFOUND steemd.steemit.com steemd.steemit.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
Unhandled rejection Error: getaddrinfo ENOTFOUND steemd.steemit.com steemd.steemit.com:443
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
Am I to understand that the Steemit team discontinued this endpoint and did not update the library they provide...? That would be beyond my belief.
"That would be beyond my belief." Welcome to steem development :)
Yup. TIL... What a mess.
For now, you can use https://api.steemit.com
because it works. My worker for https://steemcron.com wasn't working until I switched to the endpoint api
:)
this error
Unhandled rejection Error: getaddrinfo ENOTFOUND steemd.steemit.com steemd.steemit.com:443
I keep having it on all kind of endpoints. Also tried api.steemit, that from minnowproject and the full node that is runned by reggeamuffin and his group. All those give me the same error.
The services / bot are running fine.. Just once a while this error kicks in
(Glad I'm not the only one seeing this... being a bit new to JS api writing, I thought I "missed" something in my code!)
I've run into the same problem, but with something even more interesting. My project attempts to connect to 2 different endpoints - the standard STEEM blockchain as well as the steem.vc testnet blockchain - so "setOptions" runs on almost every call.
When the problem occurs, BOTH endpoints are broken. If it was a websockets problem or a problem with the endpoint itself, I would expect only the live blockchain OR the test blockchain would fail. But when the problem occurs, it fails on BOTH blockchains. Seems that SteemJS is losing track of something that it needs - and once it loses it once, it can't reset without restarting the application.
I should note, also, that it doesn't matter what operation is being done - even obtaining user info. It isn't just voting. It seems any access to the blockchain gets blocked.
No idea what it may be, but hopefully this info can help.