AsamK / signal-cli

signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
GNU General Public License v3.0
3.17k stars 299 forks source link

When trying to link device, I get a "Link request error: Connection closed!" #1567

Closed christian-hackyourshack closed 1 month ago

christian-hackyourshack commented 1 month ago

I am running signal-cli from bbernhard/siganl-cli-rest-api docker image on WSL2 (Windows 11 with no special proxy or firewall setup, currently on a fairly slow LTE/4G connection). Find the previous discussion here: https://github.com/bbernhard/signal-cli-rest-api/issues/574.

When trying to link the instance as device I get the aforementioned "Link request error: Connection closed!" error.

When activating debug mode and trying the underlying commands from within the docker command it is the same. Please find the attached output.

Started Signal REST API
{"versions":["v1","v2"],"build":2,"mode":"json-rpc","version":"0.88","capabilities":{"v2/send":["quotes","mentions"]}}
To register a secondary device to an existing account, go to
http://localhost:9022/v1/qrcodelink?device_name=chatally
+ set -e
+ [ -z /home/.local/share/signal-cli ]
+ usermod -u 1000 signal-api
usermod: no changes
+ groupmod -g 1000 signal-api
+ chown 1000:1000 -R /home/.local/share/signal-cli
+ cat
+ cap_prefix=-cap_
+ cat /proc/sys/kernel/cap_last_cap
+ seq -s ,-cap_ 0 37
+ caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37
+ [ json-rpc = json-rpc ]
+ /usr/bin/jsonrpc2-helper
time="2024-08-19T08:24:12Z" level=info msg="Updated jsonrpc2.yml"
+ [ -n  ]
+ service supervisor start
Starting supervisor: supervisord.
+ supervisorctl start all
+ hostname -I
+ awk {print $1}
+ export HOST_IP=172.17.0.2
+ exec setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37 signal-cli-rest-api -signal-cli-config=/home/.local/share/signal-cli
time="2024-08-19T08:24:13Z" level=info msg="Started Signal Messenger REST API"
[GIN] 2024/08/19 - 08:24:15 | 200 |        54.6µs |      172.17.0.1 | GET      "/v1/about"
[GIN] 2024/08/19 - 08:24:15 | 204 |       151.5µs |      172.17.0.1 | POST     "/v1/configuration"
time="2024-08-19T08:24:28Z" level=debug msg="json-rpc command: {\"jsonrpc\":\"2.0\",\"method\":\"startLink\",\"id\":\"7a74377b-8c82-415a-8b4a-61d0517cbdb8\",\"params\":{}}"
time="2024-08-19T08:24:35Z" level=debug msg="json-rpc received data: {\"jsonrpc\":\"2.0\",\"error\":{\"code\":-3,\"message\":\"Link request error: Connection closed!\",\"data\":null},\"id\":\"7a74377b-8c82-415a-8b4a-61d0517cbdb8\"}\n"
time="2024-08-19T08:24:35Z" level=debug msg="json-rpc command response message: "
time="2024-08-19T08:24:35Z" level=debug msg="json-rpc response error: Link request error: Connection closed!"
time="2024-08-19T08:24:35Z" level=debug msg="json-rpc command error code: -3"
[GIN] 2024/08/19 - 08:24:35 | 400 |    6.6569352s |      172.17.0.1 | GET      "/v1/qrcodelink?device_name=chatally"

Any help or hints are very much welcomed.

christian-hackyourshack commented 1 month ago

Today, without me doing anything different (I have even scripted the server startup and cleaning of configuration files), it suddenly worked and displayed the QR code which allowed me to link the server to my Signal account. Seems the Signal server has better and worse days and does not always play well with third-party applications.

I doubt, that further investigation will bring any improvement, hence I am closing this issue.