Signal API bug with persistent storage
:mega: Notification Service(s) Impacted Signal-api
:lady_beetle: Describe the bug Signal API works with Apprise's CLI (although with a warning), but fails with the Web-UI and the Web API.
:bulb: Screenshots and Logs
$ docker logs apprise
2022-08-24 17:19:09,756 [DEBUG] apprise: Loaded URL: signal://signal-api:8080/123456789/?batch=no&status=no&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2022-08-24 17:19:09,757 [INFO] apprise: Loaded 3 entries from memory://
2022-08-24 17:19:09,758 [INFO] apprise: Notifying 1 service(s) asynchronously.
2022-08-24 17:19:09,760 [WARNING] apprise: There were no Signal API targets to notify.
2022-08-24 17:19:09,766 [WARNING] django.request: Failed Dependency: /notify/apprise
2022/08/24 22:19:09 [info] 9#9: *7 recv() failed (104: Connection reset by peer) while sending to client, client: 5.6.7.8, server: , request: "POST /notify/apprise HTTP/1.1", upstream: "http://127.0.0.1:8080/notify/apprise", host: "apprise:12345"
command to trigger this with the stateful API
$ curl -X POST -d '{"tag":"signal", "body":"test message"}' -H "Content-Type: application/json" https://apprise:12345/notify/apprise
{"error": "One or more notification could not be sent."}
and the Apprise configuration file
urls:
- signal://signal-api:8080/123456789:
- tag: signal
The CLI works but triggers a warning
$ docker exec -it apprise bash
$ apprise -vvv -t "Test Message Title" -b "Test Message Body" \
signal://signal-api:8080/123456789
2022-08-24 22:34:53,601 - DEBUG - Loaded Signal API URL: signal://signal-api:8080/123456789/?batch=no&status=no&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2022-08-24 22:34:53,602 - DEBUG - Using selector: EpollSelector
2022-08-24 22:34:53,603 - INFO - Notifying 1 service(s) asynchronously.
2022-08-24 22:34:53,609 - DEBUG - Signal API POST URL: http://signal-api:8080/v2/send (cert_verify=True)
2022-08-24 22:34:53,610 - DEBUG - Signal API Payload: {'message': 'Test Message Title\r\nTest Message Body', 'number': '123456789', 'recipients': ['123456789']}
2022-08-24 22:34:57,640 - WARNING - A Connection error occured sending 1 Signal API notification(s).
2022-08-24 22:34:57,640 - DEBUG - Socket Exception: HTTPConnectionPool(host='signal-api', port=8080): Read timed out. (read timeout=4.0)
and the stateless API works for some reason despite the message
$ curl -X POST -d '{"urls":"signal://signal-api:8080/123456789", "body":"test message"}' -H "Content-Type: application/json" https://apprise:12345/notify
One or more notification could not be sent.
In short:
- stateless Web-API works
- stateful (persistent storage) Web-API fails
- CLI works
- Web-UI notification test fails
My guess is that Apprise does not translate the configuration into a proper call.
:computer: Your System Details:
- OS: Debian 11
- Python Version: 3.10.6
:crystal_ball: Additional context I am using the latest Docker image (v0.8.0).
Interesting, is your curl command taking longer then 4 seconds? The error implies your timing out.
What happens if you do:
# Increase the connection timeout to 30 seconds
apprise -vvv -t "Test Message Title" -b "Test Message Body" \
signal://signal-api:8080/123456789?cto=30
Setting cto=30 does nothing for some reason
www-data@apprise:/opt/apprise$ apprise -vvv -t "Test Message Title" -b "Test Message Body" signal://signal-api:8080/123456789?cto=30
2022-09-01 14:57:21,018 - DEBUG - Loaded Signal API URL: signal://signal-api:8080/123456789/?batch=no&status=no&format=text&overflow=upstream&rto=4.0&cto=30.0&verify=yes
2022-09-01 14:57:21,019 - DEBUG - Using selector: EpollSelector
2022-09-01 14:57:21,021 - INFO - Notifying 1 service(s) asynchronously.
2022-09-01 14:57:21,031 - DEBUG - Signal API POST URL: http://signal-api:8080/v2/send (cert_verify=True)
2022-09-01 14:57:21,031 - DEBUG - Signal API Payload: {'message': 'Test Message Title\r\nTest Message Body', 'number': '123456789', 'recipients': ['123456789']}
2022-09-01 14:57:25,067 - WARNING - A Connection error occured sending 1 Signal API notification(s).
2022-09-01 14:57:25,067 - DEBUG - Socket Exception: HTTPConnectionPool(host='signal-api', port=8080): Read timed out. (read timeout=4.0)
however, setting rto=30 does not produce a warning
www-data@apprise:/opt/apprise$ apprise -vvv -t "Test Message Title" -b "Test Message Body" signal://signal-api:8080/123456789?rto=30
2022-09-01 14:58:46,981 - DEBUG - Loaded Signal API URL: signal://signal-api:8080/123456789/?batch=no&status=no&format=text&overflow=upstream&rto=30.0&cto=4.0&verify=yes
2022-09-01 14:58:46,982 - DEBUG - Using selector: EpollSelector
2022-09-01 14:58:46,983 - INFO - Notifying 1 service(s) asynchronously.
2022-09-01 14:58:46,990 - DEBUG - Signal API POST URL: http://signal-api:8080/v2/send (cert_verify=True)
2022-09-01 14:58:46,990 - DEBUG - Signal API Payload: {'message': 'Test Message Title\r\nTest Message Body', 'number': '123456789', 'recipients': ['123456789']}
2022-09-01 14:58:59,697 - INFO - Sent 1 Signal API notification to 123456789.
Is there a way to set rto=30 in the YAML configuration?
You should be able to just add it and it will work:
...
urls:
- signal://credentials?rto=30
- tag: signal
Or this should work too:
...
urls:
- "signal://credentials":
- tag: signal
rto: 30
Surprised to see it take as long it does. One thing i could do is just bump the default value of the read timeout for signal in Apprise from 4 seconds to... 10? I mean it seems a little strange it's taking longer then even 4 seconds to communicate with your server. Is your machine under a lot of stress? Or is it an older one that has these delays from time to time?
What happens if you do:
time apprise -vvv -t "Test Message Title" -b "Test Message Body" signal://signal-api:8080/123456789?rto=30
I'd be curious the time it is taking (do it a few times maybe so you can get like an average
It seems to take about 12 seconds for me on average (repeated 5 times). I have about 30 running Docker containers, but the machine is rarely under any load.
www-data@apprise:/opt/apprise$ time apprise -vvv -t "Test Message Title" -b "Test Message Body" signal://signal-api:8080/123456789?rto=30
2022-09-01 23:13:08,672 - DEBUG - Loaded Signal API URL: signal://signal-api:8080/123456789/?batch=no&status=no&format=text&overflow=upstream&rto=30.0&cto=4.0&verify=yes
2022-09-01 23:13:08,673 - DEBUG - Using selector: EpollSelector
2022-09-01 23:13:08,674 - INFO - Notifying 1 service(s) asynchronously.
2022-09-01 23:13:08,681 - DEBUG - Signal API POST URL: http://signal-api:8080/v2/send (cert_verify=True)
2022-09-01 23:13:08,682 - DEBUG - Signal API Payload: {'message': 'Test Message Title\r\nTest Message Body', 'number': '123456789', 'recipients': ['123456789']}
2022-09-01 23:13:18,350 - INFO - Sent 1 Signal API notification to 123456789.
real 0m12.545s
user 0m2.560s
sys 0m0.246s
But this is a fairly minor problem, the main issue is that I cannot trigger signal remotely using a configuration (stateful).
Unfortunately, adding rto: 30 to the YAML configuration does not solve it: both Web-UI and stateful curl triggers fail.
YAML
urls:
- "signal://signal-api:8080/123456789":
- to: 123456789
tag: signal
rto: 30
leads to the Web-UI log
2022-09-01 16:25:01,607 INFO Applying Google Mail Defaults
2022-09-01 16:25:01,608 INFO Loaded 4 entries from memory://
2022-09-01 16:25:01,609 INFO Notifying 1 service(s) asynchronously.
2022-09-01 16:25:01,621 WARNING There were no Signal API targets to notify.
and the Docker Apprise log
$ docker logs -f --tail=0 apprise
2022-09-01 16:26:38,132 [INFO] apprise: Applying Google Mail Defaults
2022-09-01 16:26:38,133 [INFO] apprise: Loaded 4 entries from memory://
2022-09-01 16:26:38,135 [INFO] apprise: Notifying 1 service(s) asynchronously.
2022-09-01 16:26:38,137 [WARNING] apprise: There were no Signal API targets to notify.
2022-09-01 16:26:38,142 [WARNING] django.request: Failed Dependency: /notify/apprise
2022/09/01 23:26:38 [info] 9#9: *58 recv() failed (104: Connection reset by peer) while sending to client, client: 5.6.7.8, server: , request: "POST /notify/apprise HTTP/1.1", upstream: "http://127.0.0.1:8080/notify/apprise", host: "apprise:12345"
172.16.20.20 - - [01/Sep/2022:23:26:38 +0200] "POST /notify/apprise HTTP/1.1" 424 278 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36"
curl with the stateful configuration leads to the same Docker Apprise log.
But this is a fairly minor problem, the main issue is that I cannot trigger signal remotely using a configuration (stateful).
Unfortunately, adding rto: 30 to the YAML configuration does not solve it: both Web-UI and stateful curl triggers fail.
I hear you. Looks like this is definitely a bug. I'll investigate further and let you know as I learn more or can patch it up 👍
This has been fixed now in the master branch. 🚀 Closing this ticket off