Unable to Connect Polkadot.js Apps to Dockerized Aleph-nodes in WSL2

49 views Asked by At

I am using WSL2 to run multiple Alephnodes within Docker containers for network testing purposes. The network appears to start successfully based on the logs. However, I am encountering issues when trying to connect to these nodes using https://polkadot.js.org/apps/.

The general process for starting the network involves the following steps:

#Build the Aleph-node with the following command:
cargo build --release

#Clean up the existing data directory:
rm -rf ./docker/data

#Build the Docker image with the specified Dockerfile:
docker build --tag aleph-node:latest -f ./docker/Dockerfile .

#Execute the script to run the consensus process:
.github/scripts/run_consensus.sh

When attempting to connect to a local node, I receive the message "Waiting to establish a connection with the remote endpoint," and the connection does not proceed.

If I try to use ws://0.0.0.0:9944 in the "Custom" connection option, I encounter the following error message: "Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS."

When using wss://0.0.0.0:9944 in the "Custom" option, I still receive the message "Waiting to establish a connection with the remote endpoint."

In my docker-compose.yml, I have configured the nodes to use network_mode: host, and I have set the environment variable DISCOVER_LOCAL=true.

Additionally, I have specified the following in my Dockerfile: EXPOSE 30333 30343 9944.

It's worth noting that I don't encounter any connectivity issues when using these settings on native Ubuntu/macOS (as reported by my colleagues).

Can someone please help me understand how to properly configure the WebSocket connection and resolve this issue specifically in the context of WSL2?

PS. I used both a browser running on Windows 11 and a browser running within WSL2 (Ubuntu), and experienced the same non-functional behavior.

0

There are 0 answers