polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.06k stars 342 forks source link

Deno, rpc staking.validators error: API-WS: disconnected from wss://rpc.polkadot.io: 1000:: Normal Closure #5693

Open Anastasiia-Khab opened 11 months ago

Anastasiia-Khab commented 11 months ago

I encontered an error when trying to call polkadot and kusama rpc.

the code:

        const validators = await api.query.staking.validators.entries<
          ValidatorPrefs,
          [AccountId]
        >();

the error polkadot:

2023-07-17           API-WS: disconnected from wss://rpc.polkadot.io: 1000:: Normal Closure
2023-07-17           RPC-CORE: queryStorageAt(keys: Vec<StorageKey>, at?: BlockHash): Vec<StorageChangeSet>:: disconnected from wss://rpc.polkadot.io: 1000:: Normal Closure
2023-07-17           RPC-CORE: queryStorageAt(keys: Vec<StorageKey>, at?: BlockHash): Vec<StorageChangeSet>:: disconnected from wss://rpc.polkadot.io: 1000:: Normal Closure
An error occurred: Error: disconnected from wss://rpc.polkadot.io: 1000:: Normal Closure
    at WebSocket.#onSocketClose (https://deno.land/x/polkadot@0.2.41/rpc-provider/ws/index.ts:431:19)
    at WebSocket.wrappedHandler (ext:deno_web/02_event.js:1426:12)
    at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7)
    at invokeEventListeners (ext:deno_web/02_event.js:839:5)
    at dispatch (ext:deno_web/02_event.js:696:9)
    at WebSocket.dispatchEvent (ext:deno_web/02_event.js:1101:12)
    at WebSocket.[[[eventLoop]]] (ext:deno_websocket/01_websocket.js:492:16)
    at eventLoopTick (ext:core/01_core.js:183:11)

the error kusama:

2023-07-17    API-WS: disconnected from wss://kusama-rpc.polkadot.io: 1000:: Normal Closure
2023-07-17    RPC-CORE: queryStorageAt(keys: Vec<StorageKey>, at?: BlockHash): Vec<StorageChangeSet>:: disconnected from wss://kusama-rpc.polkadot.io: 1000:: Normal Closure
at?: BlockHash): Vec<StorageChangeSet>:: disconnected from wss://kusama-rpc.polkadot.io: 1000:: Normal Closure
2023-07-17    
![Screenshot from 2023-07-17 14-56-34](https://github.com/polkadot-js/api/assets/19766243/d32ab75b-f883-4130-88b0-bf2647d1cec9)
![Screenshot from 2023-07-17 14-56-53](https://github.com/polkadot-js/api/assets/19766243/68565905-c934-4e08-9f9e-1db1d0eea0b1)
 RPC-CORE: queryStorageAt(keys: Vec<StorageKey>, at?: BlockHash): Vec<StorageChangeSet>:: disconnected from wss://kusama-rpc.polkadot.io: 1000:: Normal Closure
An error occurred: Error: disconnected from wss://kusama-rpc.polkadot.io: 1000:: Normal Closure
    at WebSocket.#onSocketClose (https://deno.land/x/polkadot@0.2.41/rpc-provider/ws/index.ts:431:19)
    at WebSocket.wrappedHandler (ext:deno_web/02_event.js:1426:12)
    at innerInvokeEventListeners (ext:deno_web/02_event.js:792:7)
    at invokeEventListeners (ext:deno_web/02_event.js:839:5)
    at dispatch (ext:deno_web/02_event.js:696:9)
    at WebSocket.dispatchEvent (ext:deno_web/02_event.js:1101:12)
    at WebSocket.[[[eventLoop]]] (ext:deno_websocket/01_websocket.js:492:16)
    at eventLoopTick (ext:core/01_core.js:183:11)

It's same for both, kusama and polkadot api. And it worked before, but the error appeared approximately 2-3 weeks ago. Also, the query works at https://polkadot.js.org/apps/#/chainstate

I would be thankful for any thoughts or help.

PS: My guess is that , since I am using Deno, the error is related to the versions:

jacogr commented 7 months ago

Is this still an issue with latest?

(Deno is a bit of a moving target since it is not somethin gI actually test on a daily/weekly/monthly basis)