fix: add dynamic rate limits (#2892)

This commit is contained in:
David Nguyen
2026-05-31 00:34:28 +10:00
committed by GitHub
parent 22ceff43e3
commit 61138cdd81
54 changed files with 3306 additions and 109 deletions
+12 -3
View File
@@ -95,13 +95,22 @@ export const authenticatedMiddleware = <
{ metadata, logger: apiLogger },
);
} catch (err) {
console.log({ err });
apiLogger.info(infoToLog);
apiLogger.info({
...infoToLog,
error: err,
});
let message = 'Unauthorized';
if (err instanceof AppError) {
if (err.code === AppErrorCode.TOO_MANY_REQUESTS) {
return {
status: 429,
body: { message: err.message },
headers: err.headers,
} as const;
}
message = err.message;
}