Skip to content

bug: admin/v1/peers endpoint not working "The dial request has no valid addresses" #2565

@PearsonWhite

Description

@PearsonWhite

Description

I am trying to get jswaku to connect to a peer.

When calling admin/v1/peers with a valid address, I still get "The dial request has no valid address".
Tested on a kubernetes cluster and locally with docker containers.

curl -X POST http://localhost:3000/admin/v1/peers -H 'Content-Type: application/json' -d '{"peerMultiaddrs": ["/ip4/172.19.0.2/tcp/60000/p2p/16Uiu2HAmMv8cb8C6cz2jzKy9adm7zbydWNGisebaHVv5wDeQmM3i"]}'
{"peersAdded":0,"peerErrors":[{"peerMultiaddr":"/ip4/172.19.0.2/tcp/60000/p2p/16Uiu2HAmMv8cb8C6cz2jzKy9adm7zbydWNGisebaHVv5wDeQmM3i","error":"The dial request has no valid addresses"}]}

Expected Behavior

I was expecting the node with the address /ip4/172.19.0.2/tcp/60000/p2p/16Uiu2HAmMv8cb8C6cz2jzKy9adm7zbydWNGisebaHVv5wDeQmM3i to be added as a peer for jwaku.

Steps to Reproduce

# Settings
jswaku_commit_num=449797d5c1
jswaku_image="pearsonwhite/jswaku_${jswaku_commit_num}"

docker-buildx build --progress=plain -t ${jswaku_image} --load .

# nwaku amd v0.36
# nwaku_image="pearsonwhite/nwaku:v0.36.0-rc.0"
# nwaku arm commit 75375111acfc575
nwaku_image="pearsonwhite/nwaku_arm:v75375111acfc575"

custom_network_name="my_custom_network"

if ! docker network inspect "$custom_network_name" >/dev/null 2>&1; then
  docker network create --attachable --driver bridge "$custom_network_name"
fi

docker-buildx build --progress=plain -t ${jswaku_image} --load .

nwaku_args=(--lightpush=true --relay=true --max-connections=500 --rest=true --rest-admin=true --rest-address=0.0.0.0 --discv5-discovery=true --discv5-enr-auto-update=True --log-level=INFO --metrics-server=True --metrics-server-address=0.0.0.0  --cluster-id=2 --shard=0)
lps_container_id=$(docker run -d -ti --hostname="lpserver-0-0" --network="$custom_network_name" -p 8645:8645 ${nwaku_image} "${nwaku_args[@]}")
echo Lightpush Server Container Id: $lps_container_id
lps_container_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{if eq .NetworkID "'"$(docker network inspect -f '{{.Id}}' $custom_network_name)"'"}}{{.IPAddress}}{{end}}{{end}}' $lps_container_id)
echo Lightpush Server Ip: $lps_container_ip

lpc_container_id=$(docker run -d -ti --hostname="lpclient-0-0" --network="$custom_network_name" -p 3000:3000 ${jswaku_image})
echo Lightpush Client Container Id: $lpc_container_id
lpc_container_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{if eq .NetworkID "'"$(docker network inspect -f '{{.Id}}' $custom_network_name)"'"}}{{.IPAddress}}{{end}}{{end}}' $lpc_container_id)
echo Lightpush Client Ip: $lpc_container_ip

echo "Wait for server"
sleep 5

echo Running curl commands.

node="localhost"
curl -X POST http://${node}:3000/admin/v1/create-node \
  -H "Content-Type: application/json" \
  -d '{
    "defaultBootstrap": true,
    "networkConfig": {
      "clusterId": 2,
      "shards": [0, 1]
    }
  }'

sleep 1

curl -X POST http://$node:3000/admin/v1/start-node \
  -H "Content-Type: application/json"

sleep 1

curl -X GET http://$node:3000/debug/v1/info \
  -H "Content-Type: application/json"

sleep 1

addrs1=$(curl -X GET http://$node:8645/debug/v1/info \
  -H "Content-Type: application/json" | jq '.listenAddresses[0]' -r)
echo Server address: $addrs1

sleep 1

curl -X POST http://$node:3000/admin/v1/peers \
  -H "Content-Type: application/json" \
  -d "{\"peerMultiaddrs\": [\"${addrs1}\"]}"

echo done

Environment Details

MacOs Sonoma
jwaku commit: 449797d5c15c278b14952ac4db828e50116e1a61
Same results both locally with Docker images (script above) and on Kubernetes cluster

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingeffort/hoursEstimated to take a few hours.maintenanceMarks maintenance type of tasks.

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions