Fix .well-known MatrixRTC transports fallback not kicking in for widgets (#34726)

This fallback code path was looking for the wrong error code (M_UNRECOGNIZED is the correct code for endpoints that a server does not implement, and is what Synapse returns on the transports endpoint in practice when msc4143_enabled is false).
This commit is contained in:
Robin
2026-08-18 07:36:20 +00:00
committed by GitHub
parent 2a1fdeedaf
commit 28c1033e8a
2 changed files with 3 additions and 3 deletions
@@ -758,7 +758,7 @@ export class ElementWidgetDriver extends WidgetDriver {
// If the homeserver does not support the API, fall back to legacy well-known lookup.
if (
e instanceof MatrixError &&
e.errcode === "M_NOT_FOUND" &&
e.errcode === "M_UNRECOGNIZED" &&
SdkConfig.get("enable_client_well_known_lookups")
) {
const wellKnown = await client.waitForClientWellKnown();
@@ -462,7 +462,7 @@ describe("ElementWidgetDriver", () => {
return sdkConfigGet(key, altCaseName);
});
client.cachedRtcTransports.wait.mockRejectedValue(
new MatrixError({ errcode: "M_NOT_FOUND", error: "Not found" }, 404),
new MatrixError({ errcode: "M_UNRECOGNIZED", error: "Not found" }, 404),
);
await expect(driver.getRtcTransports()).rejects.toThrow();
@@ -492,7 +492,7 @@ describe("ElementWidgetDriver", () => {
return sdkConfigGet(key, altCaseName);
});
client.cachedRtcTransports.wait.mockRejectedValue(
new MatrixError({ errcode: "M_NOT_FOUND", error: "Not found" }, 404),
new MatrixError({ errcode: "M_UNRECOGNIZED", error: "Not found" }, 404),
);
const transports = [{ type: "livekit", livekit_service_url: "https://livekit-jwt.example.com" }];