Only return null if there is no endpoint available.

This commit is contained in:
Timo K.
2026-10-15 12:42:36 +02:00
parent 1913a099ab
commit a427206792
@@ -72,6 +72,7 @@ export async function findRemotePublishLivekitTransport({
roomId, roomId,
slotId, slotId,
}); });
try {
// The SFU treats an absent canPublish grant as publishing allowed. // The SFU treats an absent canPublish grant as publishing allowed.
if (decodeSFUJWTPayload(jwt).video.canPublish !== false) { if (decodeSFUJWTPayload(jwt).video.canPublish !== false) {
logger.info(`Publishing on remote SFU ${url} of ${serverName}`); logger.info(`Publishing on remote SFU ${url} of ${serverName}`);
@@ -80,6 +81,13 @@ export async function findRemotePublishLivekitTransport({
logger.info( logger.info(
`${serverName} does not let us publish on ${url}, skipping`, `${serverName} does not let us publish on ${url}, skipping`,
); );
continue;
} catch (e) {
logger.info(
`${serverName}: failed to decode SFUJWT payload: ${e}, skipping`,
);
continue;
}
} catch (e) { } catch (e) {
if (isCsApiUnavailable(e)) { if (isCsApiUnavailable(e)) {
// Without the endpoint no further candidate can work // Without the endpoint no further candidate can work
@@ -89,6 +97,7 @@ export async function findRemotePublishLivekitTransport({
return null; return null;
} }
logger.warn(`Failed to get a token for ${url} of ${serverName}:`, e); logger.warn(`Failed to get a token for ${url} of ${serverName}:`, e);
continue;
} }
} }
} }