Key backup fails (using Hydrogen) #262

Closed
opened 2022-04-10 09:45:49 +00:00 by paulvt · 16 comments
paulvt commented 2022-04-10 09:45:49 +00:00 (Migrated from gitlab.com)

Description

I tried to enable key backup in Hydrogen (because it's a lighter browser-based client I can use on my phone).
In 0.3.0 it always failed, but in 0.3.0-next (commit 6e106b5) Hydrogen can enable it but the backup fails with the following error:

Key backup is enabled, using backup version 173124.

Backup has stopped because of an error: HTTP error status 405 without errcode in body, assume this is a load balancer complaining the server is offline.

There is no error in the Conduit logs. Relevant part from the Apache forwarding proxy logs:

[...] - - [10/Apr/2022:11:40:22 +0200] "PUT /_matrix/client/r0/room_keys/keys?version=173124 HTTP/1.1" 405 291 [...]

System Configuration

Conduit Version: 0.3.0-next (commit 6e106b5)
Database backend: sqlite

<!-- If you're requesting a new feature, that isn't part of this project yet, then please consider filling out a "Feature Request" instead! If you need a hand setting up your conduit server, feel free to ask for help in the Conduit Matrix Chat: https://matrix.to/#/#conduit:fachschaften.org. --> ### Description I tried to enable key backup in Hydrogen (because it's a lighter browser-based client I can use on my phone). In 0.3.0 it always failed, but in 0.3.0-next (commit 6e106b5) Hydrogen can enable it but the backup fails with the following error: > Key backup is enabled, using backup version 173124. > > Backup has stopped because of an error: HTTP error status 405 without errcode in body, assume this is a load balancer complaining the server is offline. There is no error in the Conduit logs. Relevant part from the Apache forwarding proxy logs: ``` [...] - - [10/Apr/2022:11:40:22 +0200] "PUT /_matrix/client/r0/room_keys/keys?version=173124 HTTP/1.1" 405 291 [...] ``` ### System Configuration <!-- Other data that might help us debug this issue, like os, conduit version, database backend --> Conduit Version: 0.3.0-next (commit 6e106b5)\ Database backend: sqlite
M0dEx commented 2022-04-10 12:48:40 +00:00 (Migrated from gitlab.com)

The endpoint is implemented, but not registered as a route (client_server::add_backup_keys_route).

@timokoesters Is there a reason for that? If not, I can make a MR that adds it.

The endpoint is implemented, but not registered as a route (`client_server::add_backup_keys_route`). @timokoesters Is there a reason for that? If not, I can make a MR that adds it.
M0dEx commented 2022-04-10 16:19:17 +00:00 (Migrated from gitlab.com)

assigned to @M0dEx

assigned to @M0dEx
M0dEx commented 2022-04-10 20:10:39 +00:00 (Migrated from gitlab.com)

@paulvt
I have created a branch with the route added: 262-missing_room_keys_endpoint.

Could you kindly try to build the conduit container using that branch and trying the key backup again?

I have tested it locally (set up secure backup in Element and then enabled key backup in Hydrogen) and everything seems to work correctly now.

@paulvt I have created a branch with the route added: `262-missing_room_keys_endpoint`. Could you kindly try to build the conduit container using that branch and trying the key backup again? I have tested it locally (set up secure backup in Element and then enabled key backup in Hydrogen) and everything seems to work correctly now.
deki commented 2022-04-10 20:32:57 +00:00 (Migrated from gitlab.com)

The route seems to have accidentally gotten lost in b8411ae2fd.

The route seems to have accidentally gotten lost in b8411ae2fd359e890b3805116b3b32f9aed16e74.
M0dEx commented 2022-04-10 21:29:38 +00:00 (Migrated from gitlab.com)

created branch 262-key-backup-fails-using-hydrogen to address this issue

created branch [`262-key-backup-fails-using-hydrogen`](/famedly/conduit/-/compare/next...262-key-backup-fails-using-hydrogen) to address this issue
M0dEx commented 2022-04-10 21:32:46 +00:00 (Migrated from gitlab.com)

mentioned in merge request !346

mentioned in merge request !346
timokoesters commented 2022-04-11 16:06:00 +00:00 (Migrated from gitlab.com)

mentioned in commit 2fcb3c8b93

mentioned in commit 2fcb3c8b936aea83eb9445919e69ef7627bced84
paulvt commented 2022-04-14 20:57:12 +00:00 (Migrated from gitlab.com)

When running 0.3.0-next from commit 2fcb3c8, I still get the same HTTP 405 response.

When running 0.3.0-next from commit 2fcb3c8, I still get the same HTTP 405 response.
paulvt commented 2022-04-15 07:50:05 +00:00 (Migrated from gitlab.com)

Yes, I did a git pull and built it anew. Then tested Hydrogen again by nuking the existing backup and retrying. Saw the same 405 in the logs.

Yes, I did a git pull and built it anew. Then tested Hydrogen again by nuking the existing backup and retrying. Saw the same 405 in the logs.
M0dEx commented 2022-04-15 09:39:28 +00:00 (Migrated from gitlab.com)

Correct me if I am wrong, but key backup cannot be set up with Hydrogen. It can only be set up with Element and then activated in Hydrogen, no?

Correct me if I am wrong, but key backup cannot be set up with Hydrogen. It can only be set up with Element and then activated in Hydrogen, no?
paulvt commented 2022-04-15 09:52:11 +00:00 (Migrated from gitlab.com)

I am unsure, how the backup came to be. I only use Hydrogen with this session, but I logged in with Element Web now. It says:

Backup key stored: in secret storage
Backup key cached: cached locally, well formed
Secret storage public key: in account data
Secret storage: ready
Backup version: 173124
Algorithm: m.megolm_backup.v1.curve25519-aes-sha2

In Hydrogen, it says:

Key backup is enabled, using backup version 173124. Backup has stopped because of an error:
HTTP error status 405 without errcode in body, assume this is a load balancer complaining the server is offline.

Note that I checked the setting "Backup my device as well", which may allow the backup to be enabled fine but not the additional session/device?

If I disable the backup, it suddenly comes with another error that might be useful:

Could not enable key backup: M_NOT_FOUND: Unknown or unimplemented route on PUT /_matrix/client/unstable/org.matrix.msc2697.v2/dehydrated_device?.

So that sounds like also an unstable route is involved 🤔

I am unsure, how the backup came to be. I only use Hydrogen with this session, but I logged in with Element Web now. It says: | Backup key stored: | in secret storage | |----------------------------|----------------------------------------| | Backup key cached: | cached locally, well formed | | Secret storage public key: | in account data | | Secret storage: | ready | | Backup version: | 173124 | | Algorithm: | m.megolm_backup.v1.curve25519-aes-sha2 | In Hydrogen, it says: > Key backup is enabled, using backup version 173124. Backup has stopped because of an error: > HTTP error status 405 without errcode in body, assume this is a load balancer complaining the server is offline. Note that I checked the setting "Backup my device as well", which may allow the backup to be enabled fine but not the additional session/device? If I disable the backup, it suddenly comes with another error that might be useful: > Could not enable key backup: M_NOT_FOUND: Unknown or unimplemented route on PUT /_matrix/client/unstable/org.matrix.msc2697.v2/dehydrated_device?. So that sounds like also an unstable route is involved :thinking:
M0dEx commented 2022-04-15 10:01:34 +00:00 (Migrated from gitlab.com)

There's something weird going on.

I just tested Hydrogen key backup with the device backup enabled and both setting it up and disabling it went without a hitch.

Could you retest it again and check the Conduit log again? If there is a 405 on the /_matrix/client/r0/room_keys/keys route, it is most probably an issue with your container/setup, as I just cannot replicate that behaviour on the latest commit of the next branch.

There's something weird going on. I just tested Hydrogen key backup with the device backup enabled and both setting it up and disabling it went without a hitch. Could you retest it again and check the Conduit log again? If there is a 405 on the `/_matrix/client/r0/room_keys/keys` route, it is most probably an issue with your container/setup, as I just cannot replicate that behaviour on the latest commit of the next branch.
paulvt commented 2022-04-15 10:19:09 +00:00 (Migrated from gitlab.com)

Yes, did a rebuild, reinstall. Still the same, really weird.
Conduit and Apache logs interleaved:

[SNIP] - - [15/Apr/2022:12:09:19 +0200] "PUT /_matrix/client/unstable/org.matrix.msc2697.v2/dehydrated_device? HTTP/1.1" 404 454 [SNIP]

Apr 15 12:09:19 ... matrix-conduit[31855]: Apr 15 12:09:19.450  WARN conduit::error: 404 Not Found: M_NOT_FOUND: Unknown or unimplemented route

[SNIP] - - [15/Apr/2022:12:09:23 +0200] "PUT /_matrix/client/r0/room_keys/keys?version=708941 HTTP/1.1" 405 291 [SNIP]

It is a pity that Conduit does not show the Git commit in the admin room, but I'm really sure it is 2fcb3c8
I do use the SQLite back-end still btw, but I guess that shouldn't matter.

Is there a way to let it log the supported routes, like what Rocket does?

Yes, did a rebuild, reinstall. Still the same, really weird. Conduit and Apache logs interleaved: ``` [SNIP] - - [15/Apr/2022:12:09:19 +0200] "PUT /_matrix/client/unstable/org.matrix.msc2697.v2/dehydrated_device? HTTP/1.1" 404 454 [SNIP] Apr 15 12:09:19 ... matrix-conduit[31855]: Apr 15 12:09:19.450 WARN conduit::error: 404 Not Found: M_NOT_FOUND: Unknown or unimplemented route [SNIP] - - [15/Apr/2022:12:09:23 +0200] "PUT /_matrix/client/r0/room_keys/keys?version=708941 HTTP/1.1" 405 291 [SNIP] ``` It is a pity that Conduit does not show the Git commit in the admin room, but I'm really sure it is 2fcb3c8 I do use the SQLite back-end still btw, but I guess that shouldn't matter. Is there a way to let it log the supported routes, like what Rocket does?
M0dEx commented 2022-05-21 19:27:19 +00:00 (Migrated from gitlab.com)

@paulvt

I apologize for this taking so long, I am in the middle of the exam period for this semester, but I might have found the underlying issue causing this.

Hydrogen uses the r0 backup key endpoint (/_matrix/client/r0/room_keys/keys), instead of the v3 backup key endpoint (/_matrix/client/v3/room_keys/keys), which Conduit "listens" on. Figured this out by doing a quick test with curl.

This is not correct behaviour from Hydrogen, as per specs the v3 endpoint should be used.

All in all, I think making an issue on the Hydrogen repo would be a good next step.

@paulvt I apologize for this taking so long, I am in the middle of the exam period for this semester, but I might have found the underlying issue causing this. Hydrogen uses the **r0** backup key endpoint (`/_matrix/client/r0/room_keys/keys`), instead of the **v3** backup key endpoint (`/_matrix/client/v3/room_keys/keys`), which Conduit "listens" on. Figured this out by doing a quick test with curl. This is not correct behaviour from Hydrogen, as per [specs](https://spec.matrix.org/v1.2/client-server-api/#put_matrixclientv3room_keyskeys) the **v3** endpoint should be used. All in all, I think making an issue on the Hydrogen repo would be a good next step.
shadowjonathan commented 2022-05-22 10:44:06 +00:00 (Migrated from gitlab.com)

I created the corresponding issue here: https://github.com/vector-im/hydrogen-web/issues/741

Essentially, conduit only implements GET ../r0/room_keys/keys, not PUT, as per the spec.

I created the corresponding issue here: https://github.com/vector-im/hydrogen-web/issues/741 Essentially, conduit only implements `GET ../r0/room_keys/keys`, not `PUT`, as per the spec.
paulvt commented 2022-05-23 06:00:40 +00:00 (Migrated from gitlab.com)

Never thought about the endpoint being fixed, but the issue not being fixed because it didn't use it 😆.
Thanks! This can be closed then?

Never thought about the endpoint being fixed, but the issue not being fixed because it didn't use it :laughing:. Thanks! This can be closed then?
Sign in to join this conversation.
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Matthias/conduit#262
No description provided.