Scheduling infrastructure for absolutely everyone.
fix: some modifications to logging event detail input (#19070)
Alex van Andel252ce5dec848
diff --git a/packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts b/packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.tsindex b2d7b11a7fa..0169db4b1be 100644--- a/packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts+++ b/packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts@@ -7,6 +7,7 @@ import type { Dayjs } from "@calcom/dayjs";import { checkForConflicts } from "@calcom/features/bookings/lib/conflictChecker/checkForConflicts";import { parseBookingLimit, parseDurationLimit } from "@calcom/lib";import { ErrorCode } from "@calcom/lib/errorCodes";+import { getPiiFreeUser } from "@calcom/lib/piiFreeData";import { safeStringify } from "@calcom/lib/safeStringify";import type { getEventTypeResponse } from "./getEventTypesFromDB";@@ -101,6 +102,22 @@ export async function ensureAvailableUsers(},});+ const piiFreeInputDataForLogging = safeStringify({+ startDateTimeUtc,+ endDateTimeUtc,+ ...{+ ...input,+ originalRescheduledBooking: input.originalRescheduledBooking+ ? {+ ...input.originalRescheduledBooking,+ user: input.originalRescheduledBooking?.user+ ? getPiiFreeUser(input.originalRescheduledBooking.user)+ : null,+ }+ : undefined,+ },+ });+usersAvailability.forEach(({ oooExcludedDateRanges: dateRanges, busy: bufferedBusyTimes }, index) => {const user = eventType.users[index];@@ -112,25 +129,14 @@ export async function ensureAvailableUsers(if (!dateRanges.length) {loggerWithEventDetails.error(`User does not have availability at this time.`,- safeStringify({- startDateTimeUtc,- endDateTimeUtc,- input,- })+ piiFreeInputDataForLogging);return;}//check if event time is within the date rangeif (!hasDateRangeForBooking(dateRanges, startDateTimeUtc, endDateTimeUtc)) {- loggerWithEventDetails.error(- `No date range for booking.`,- safeStringify({- startDateTimeUtc,- endDateTimeUtc,- input,- })- );+ loggerWithEventDetails.error(`No date range for booking.`, piiFreeInputDataForLogging);return;}@@ -149,14 +155,7 @@ export async function ensureAvailableUsers(});if (availableUsers.length === 0) {- loggerWithEventDetails.error(- `No available users found.`,- safeStringify({- startDateTimeUtc,- endDateTimeUtc,- input,- })- );+ loggerWithEventDetails.error(`No available users found.`, piiFreeInputDataForLogging);throw new Error(ErrorCode.NoAvailableUsersFound);}// make sure TypeScript understands availableUsers is at least one.