Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Add critical logger for booking created log to prevent stdout buffering issues (#24570)

Joe Au-Yeungd7df154059b4
diff --git a/apps/web/modules/signup-view.tsx b/apps/web/modules/signup-view.tsx
index dc903b49303..d457b4b4571 100644
--- a/apps/web/modules/signup-view.tsx
+++ b/apps/web/modules/signup-view.tsx
@@ -313,7 +313,7 @@ export default function Signup({
id="gtm-init-script"
// It is strictly not necessary to disable, but in a future update of react/no-danger this will error.
// And we don't want it to error here anyways
- // eslint-disable-next-line react/no-danger
+
dangerouslySetInnerHTML={{
__html: `(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
@@ -323,7 +323,7 @@ export default function Signup({
}}
/>
<noscript
- // eslint-disable-next-line react/no-danger
+
dangerouslySetInnerHTML={{
__html: `<iframe src="https://www.googletagmanager.com/ns.html?id=${process.env.NEXT_PUBLIC_GTM_ID}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`,
}}
diff --git a/apps/web/playwright/dynamic-booking-pages.e2e.ts b/apps/web/playwright/dynamic-booking-pages.e2e.ts
index 8ef6ac30e6e..6bece87bf33 100644
--- a/apps/web/playwright/dynamic-booking-pages.e2e.ts
+++ b/apps/web/playwright/dynamic-booking-pages.e2e.ts
@@ -193,9 +193,9 @@ test.describe("Organization:", () => {
});
await expect(page.getByTestId("success-page")).toBeVisible();
// All the teammates should be in the booking
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
await expect(page.getByText(user1.name!, { exact: true })).toBeVisible();
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
await expect(page.getByText(user2.name!, { exact: true })).toBeVisible();
}
);
diff --git a/apps/web/playwright/lib/testUtils.ts b/apps/web/playwright/lib/testUtils.ts
index 5f4fcb98652..a7ec3b62eee 100644
--- a/apps/web/playwright/lib/testUtils.ts
+++ b/apps/web/playwright/lib/testUtils.ts
@@ -4,7 +4,7 @@ import { createHash } from "crypto";
import EventEmitter from "events";
import type { IncomingMessage, ServerResponse } from "http";
import { createServer } from "http";
-// eslint-disable-next-line no-restricted-imports
+
import type { Messages } from "mailhog";
import { totp } from "otplib";
import { v4 as uuid } from "uuid";
@@ -213,7 +213,7 @@ export async function setupManagedEvent({
addManagedEventToTeamMates: true,
managedEventUnlockedFields: unlockedFields,
});
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
const memberUser = users.get().find((u) => u.name === teamMateName)!;
const { team } = await adminUser.getFirstTeamMembership();
const managedEvent = await adminUser.getFirstTeamEvent(team.id, SchedulingType.MANAGED);
@@ -365,7 +365,7 @@ async function createUserWithSeatedEvent(users: Fixtures["users"]) {
},
],
});
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
const eventType = user.eventTypes.find((e) => e.slug === slug)!;
return { user, eventType };
}
diff --git a/apps/web/playwright/organization/booking.e2e.ts b/apps/web/playwright/organization/booking.e2e.ts
index 85bb1e3ba06..9f2b727c60c 100644
--- a/apps/web/playwright/organization/booking.e2e.ts
+++ b/apps/web/playwright/organization/booking.e2e.ts
@@ -184,7 +184,7 @@ test.describe("Bookings", () => {
// Anyone of the teammates could be the Host of the booking.
const chosenUser = await page.getByTestId("booking-host-name").textContent();
expect(chosenUser).not.toBeNull();
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
expect(teamMatesObj.concat([{ name: owner.name! }]).some(({ name }) => name === chosenUser)).toBe(
true
);
@@ -248,7 +248,7 @@ test.describe("Bookings", () => {
// Anyone of the teammates could be the Host of the booking.
const chosenUser = await page.getByTestId("booking-host-name").textContent();
expect(chosenUser).not.toBeNull();
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
expect(teamMatesObj.concat([{ name: owner.name! }]).some(({ name }) => name === chosenUser)).toBe(
true
);
diff --git a/apps/web/playwright/organization/organization-invitation.e2e.ts b/apps/web/playwright/organization/organization-invitation.e2e.ts
index 496bdc1ae41..1183634168e 100644
--- a/apps/web/playwright/organization/organization-invitation.e2e.ts
+++ b/apps/web/playwright/organization/organization-invitation.e2e.ts
@@ -90,7 +90,7 @@ test.describe("Organization", () => {
// This test is already covered by booking.e2e.ts where existing user is invited and his booking links are tested.
// We can re-test here when we want to test some more scenarios.
- // eslint-disable-next-line @typescript-eslint/no-empty-function
+
test("existing user invited to an organization", () => {});
test("nonexisting user invited to a Team inside organization", async ({
@@ -313,7 +313,7 @@ test.describe("Organization", () => {
await page.locator('[data-testid="continue-with-email-button"]').click();
await expect(page.locator('[data-testid="signup-submit-button"]')).toBeVisible();
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+
await page.locator('input[name="username"]').fill(existingUser.username!);
await page
.locator('input[name="email"]')
diff --git a/packages/features/bookings/lib/service/RegularBookingService.ts b/packages/features/bookings/lib/service/RegularBookingService.ts
index ce9d4162845..436acf08bf2 100644
--- a/packages/features/bookings/lib/service/RegularBookingService.ts
+++ b/packages/features/bookings/lib/service/RegularBookingService.ts
@@ -67,6 +67,7 @@ import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType";
import { HttpError } from "@calcom/lib/http-error";
import logger from "@calcom/lib/logger";
+import { criticalLogger } from "@calcom/lib/logger.server";
import { getPiiFreeCalendarEvent, getPiiFreeEventType } from "@calcom/lib/piiFreeData";
import { safeStringify } from "@calcom/lib/safeStringify";
import { getTranslation } from "@calcom/lib/server/i18n";
@@ -1726,7 +1727,7 @@ async function handler(
await usersRepository.updateLastActiveAt(booking.userId);
const organizerUserAvailability = availableUsers.find((user) => user.id === booking?.userId);
- logger.info(`Booking created`, {
+ criticalLogger.info(`Booking created`, {
bookingUid: booking.uid,
selectedCalendarIds: organizerUser.allSelectedCalendars?.map((c) => c.id) ?? [],
availabilitySnapshot: organizerUserAvailability?.availabilityData
diff --git a/packages/features/eventtypes/components/locations/Locations.tsx b/packages/features/eventtypes/components/locations/Locations.tsx
index f2ce3d7df39..de615985a04 100644
--- a/packages/features/eventtypes/components/locations/Locations.tsx
+++ b/packages/features/eventtypes/components/locations/Locations.tsx
@@ -149,7 +149,7 @@ const Locations: React.FC<LocationsProps> = ({
);
useEffect(() => {
- if (!!prefillLocation) {
+ if (prefillLocation) {
const newLocationType = prefillLocation.value;
const canAppendLocation = !validLocations.find((location) => location.type === newLocationType);
diff --git a/packages/lib/logger.server.ts b/packages/lib/logger.server.ts
new file mode 100644
index 00000000000..4b2fff058ea
--- /dev/null
+++ b/packages/lib/logger.server.ts
@@ -0,0 +1,24 @@
+import fs from "fs";
+
+import logger from "./logger";
+
+/** This should be used if we want to ensure a log statement is always executed.
+ *
+ * This should only be used server side
+ */
+export const criticalLogger = logger.getSubLogger({
+ name: "critical",
+ overwrite: {
+ transportJSON: (logObj) => {
+ const logString = JSON.stringify(logObj);
+ const buffer = Buffer.from(logString + "\n");
+
+ try {
+ fs.writeSync(process.stdout.fd, buffer);
+ } catch (error) {
+ console.log(`Critical logger: Failed to write log using fs.writeSync: ${error}`);
+ console.log(logString);
+ }
+ },
+ },
+});
diff --git a/packages/ui/components/form/select/Select.tsx b/packages/ui/components/form/select/Select.tsx
index 166b16a2a88..2816b556844 100644
--- a/packages/ui/components/form/select/Select.tsx
+++ b/packages/ui/components/form/select/Select.tsx
@@ -219,7 +219,7 @@ export function SelectWithValidation<
position: "absolute",
}}
value={hiddenInputValue}
- // eslint-disable-next-line @typescript-eslint/no-empty-function
+
onChange={() => {}}
// TODO:Not able to get focus to work
// onFocus={() => selectRef.current?.focus()}