Closed Sphinix1 closed 2 years ago
@reivilibre responded in the Sygnal room.
sounds like https://github.com/matrix-org/sygnal/blob/main/docs/troubleshooting.md#common-cause-1-hex-rather-than-base64-encoding — you need to base64 encode your token rather than hex encode
is this on startup or when sending a push?
It’s during push
Sent from my iPhone
On 4 Oct 2022, at 12:42, David Robertson @.***> wrote:
@reivilibre responded in the Sygnal room.
sounds like https://github.com/matrix-org/sygnal/blob/main/docs/troubleshooting.md#common-cause-1-hex-rather-than-base64-encoding — you need to base64 encode your token rather than hex encode
is this on startup or when sending a push?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
Can you please post the full stack trace and explain your setup? Are you using Synapse to talk to Sygnal or are you doing something else? Which Matrix client are you using and what modifications have you made?
fluffychat yes synapse to sygnal
Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/http.py", line 275, in _handle_dispatch Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: result = await pushkin.dispatch_notification(notif, d, context) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/notifications.py", line 217, in dispatch_notification Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: return await self._dispatch_notification_unlimited(n, device, context) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/apnspushkin.py", line 347, in _dispatch_notification_unlimited Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: log, span, device, shaved_payload, prio Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/apnspushkin.py", line 245, in _dispatch_request Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: device_token = base64.b64decode(device.pushkey).hex() Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/base64.py", line 87, in b64decode Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: return binascii.a2b_base64(s) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: binascii.Error: Invalid base64-encoded string: number of data characters (157) cannot be 1 more than a multiple of 4 Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: 2022-10-05 19:03:39,233 [1] ERROR sygnal.http [c009397b-3664-4203-ac63-31053f28a481] Exception whilst dispatching notification. Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: Traceback (most recent call last): Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/http.py", line 275, in _handle_dispatch Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: result = await pushkin.dispatch_notification(notif, d, context) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/notifications.py", line 217, in dispatch_notification Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: return await self._dispatch_notification_unlimited(n, device, context) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/apnspushkin.py", line 347, in _dispatch_notification_unlimited Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: log, span, device, shaved_payload, prio Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/site-packages/sygnal/apnspushkin.py", line 245, in _dispatch_request Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: device_token = base64.b64decode(device.pushkey).hex() Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: File "/usr/local/lib/python3.7/base64.py", line 87, in b64decode Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: return binascii.a2b_base64(s) Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: binascii.Error: Invalid base64-encoded string: number of data characters (157) cannot be 1 more than a multiple of 4 Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: 2022-10-05 19:03:39,235 [1] INFO sygnal.access Handled request: "144.214.4.183" - - [05/Oct/2022:19:03:39 +0000] "POST /_matrix/push/v1/notify HTTP/1.0" 500 - "-" "Synapse/1.68.0" Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: 2022-10-05 19:03:39,235 [1] INFO sygnal.access Handled request: "144.214.4.183" - - [05/Oct/2022:19:03:39 +0000] "POST /_matrix/push/v1/notify HTTP/1.0" 500 - "-" "Synapse/1.68.0" Oct 05 19:03:39 fluffychat matrix-sygnal[754590]: 2022-10-05 19:03:39,235 [1] INFO sygnal.access Handled request: "144.214.4.183" - - [05/Oct/2022:19:03:39 +0000] "POST /_matrix/push/v1/notify HTTP/1.0" 500 - "-" "Synapse/1.68.0"
Thanks. As @reivilibre has previously mentioned, https://github.com/matrix-org/sygnal/blob/main/docs/troubleshooting.md#common-cause-1-hex-rather-than-base64-encoding is the issue.
There is an implicit coupling between clients and the push gateway. FluffyChat was built to work with https://gitlab.com/famedly/services/famedly-push-gateway, not Sygnal.
To make FluffyChat work with Sygnal, the code in lib/utils/background_push.dart
needs to be modified to base64-encode the push token.
@squahtx FluffyChat was built to work with krille-chan/fluffygate to be exact, and it's the Push Gateway running on https://push.fluffychat.im/ which is the default gateway FluffyChat uses.
However, the incompatibility point still stands. There's also #319 which was refused to be addressed by both parties: https://github.com/famedly/matrix-dart-sdk/issues/1947, https://github.com/famedly/matrix-dart-sdk/issues/1948
Hi , can anyone help be solve this error ?
matrix-sygnal[116160]: binascii.Error: Invalid base64-encoded string: number of data characters (157) cannot be 1 more than a multiple of 4