API-WS: disconnected from ws://rpc.polkadot.io: 1006:: connection failed
See original GitHub issueI am trying to connect to the public node using the @polkadot/api npm module.
Version: "@polkadot/api": "^2.3.1"
Node Version: v12.16.2
This is my code
// Import
const { ApiPromise, WsProvider } = require('@polkadot/api');
const wsProvider = new WsProvider('ws://rpc.polkadot.io');
const main = async () => {
const api = await ApiPromise.create({ provider: wsProvider });
await api.isReady;
// Do something
console.log(api.genesisHash.toHex());
};
main();
Due to this error I am unable to use the substrate-api-sidecar docker image.
Thanks.
EDIT
The error is same for both urls ws://rpc.polkadot.io
and wss://rpc.polkadot.io
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
API dies if querying after disconnect · Issue #2257 - GitHub
Reproduce: await api.disconnect() await api.derive.staking. ... disconnected from wss://kusama-rpc.polkadot.io: 1006:: connection failed ...
Read more >API-WS: disconnected from ws://127.0.0.1:9946: 1006 ...
I'm trying to connect local node running on my pc using polkadot.js library in react.js(browser). I'm pasting my code in below snippet and ......
Read more >Connect via WSS to Polkadot Full Noder running on local ...
But when I run it on my local machine to point to wss://192.168.2.254:9944, the output is connection failed with code 1006:.
Read more >How to fix connection issues on polkadot.js
You may encounter the error "Waiting to make a connection to the remote endpoint and finishing API initialization".
Read more >Create an instance - polkadot{.js}
All API instances implement an EventEmitter interface, with on handlers, which emit connected , disconnected , ready and error events, allowing you to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you. I think it was some network issue. Now, it is working.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.