logs - avoid logging app errors in super tenant
MODIFY
src/exception/AppAuthError.ts
src/exception/AppAuthError.ts
@@ -6,7 +6,7 @@ import User from '../types/User';
import UserToken from '../types/UserToken';
export default class AppAuthError extends Error {
- constructor(public readonly params: {
+ public constructor(public readonly params: {
action: Action;
entity: Entity;
value?: string;

MODIFY
src/utils/Logging.ts
src/utils/Logging.ts
@@ -661,8 +661,11 @@ export default class Logging {
if (action === ServerAction.LOGIN && req.body.password) {
req.body.password = '####';
}
- if (req.user && req.user.tenantID) {
+ if (req.user?.tenantID) {
tenantID = req.user.tenantID;
+ } else if (req.tenant?.id !== Constants.DEFAULT_TENANT_ID) {
+ // AuthRouter endpoints may throw errors with no user token
+ tenantID = req.tenant.id;
}
if (exception instanceof AppError) {
await Logging.logActionAppException(tenantID, action, exception);

logs - avoid logging app errors in super tenant