fix(gateway): harden request handling

This commit is contained in:
Peter Steinberger
2025-12-17 22:04:22 +01:00
parent fce487669b
commit e0276ed4b4
2 changed files with 10 additions and 3 deletions

View File

@@ -69,8 +69,6 @@ export const ConnectParamsSchema = Type.Object(
modelIdentifier: Type.Optional(NonEmptyString),
mode: NonEmptyString,
instanceId: Type.Optional(NonEmptyString),
deviceFamily: Type.Optional(NonEmptyString),
modelIdentifier: Type.Optional(NonEmptyString),
},
{ additionalProperties: false },
),

View File

@@ -2024,7 +2024,8 @@ export async function startGatewayServer(
});
};
switch (req.method) {
void (async () => {
switch (req.method) {
case "connect": {
respond(
false,
@@ -3372,6 +3373,14 @@ export async function startGatewayServer(
break;
}
}
})().catch((err) => {
logError(`gateway: request handler failed: ${formatForLog(err)}`);
respond(
false,
undefined,
errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)),
);
});
} catch (err) {
logError(`gateway: parse/handle error: ${String(err)}`);
logWs("out", "parse-error", { connId, error: formatForLog(err) });