fix(gateway): harden request handling
This commit is contained in:
@@ -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 },
|
||||
),
|
||||
|
||||
@@ -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) });
|
||||
|
||||
Reference in New Issue
Block a user