1

Im using the polkadot.js api, running from a shell, and expecting to get multiple "Chain is at block #12345" messages. But i only get 1 of these messages and I do not know why.

I'm running a Polkadot node using the following docker command:

docker run -it -p 30333:30333 -p 9944:9944 -p 80:9933 -v /mnt/polkadot:/polkadot/.local/share parity/polkadot:latest --rpc-external --rpc-cors=all --chain westend --ws-external

and am following the examples in the polkadot.js api documentation

If i stop the docker container and then restart it i get 1 more message, so i know the connection is still open. it seems like the node isnt emitting the messages.

If I query wss://rpc.polkadot.io instead of my node (on port 9944) I get the expected behaviour.

Can anyone suggest a solution or steps to investigate?

John
  • 949
  • 1
  • 9
  • 20
  • sounds silly - but the 80:9933 mapping exposes the docker's 9933 port on the host 80. Is that want you want? should not effect the wss on 9944 AFAIK – Nuke Feb 25 '21 at 01:52
  • Hi John, Can you please support our Substrate StackExchange proposal: https://area51.stackexchange.com/proposals/126136 – Shawn Tabrizi Dec 16 '21 at 13:15

1 Answers1

2

The problem seems to be due to the node syncing with the network.

The node finished syncing the Westend network an hour ago and the API is now working as expected.

John
  • 949
  • 1
  • 9
  • 20
  • 1
    ah good spot. What was the way you discovered this? Monitoring the logs within the docker to see that you were synced? – Nuke Feb 25 '21 at 17:53
  • 1
    the first clue was that the cpu load had greatly decreased. the second was running `curl -H "Content-Type: application/json" --data '{ "jsonrpc":"2.0", "method":"system_health", "params":[],"id":1 }' ` which gave {"jsonrpc":"2.0","result":{"isSyncing":false,"peers":25,"shouldHavePeers":true},"id":1} – John Feb 26 '21 at 13:45