calcom/cal.diy · error · Error

We need need the booking uid to create the Daily reference…

Error message

We need need the booking uid to create the Daily reference in DB

What it means

Inside `createOrUpdateMeeting`, the adapter requires `event.uid` (the booking uid) because Daily room creation must be linked back to a Cal.diy booking for later reference lookup and recording retrieval. A missing `event.uid` is a programming-contract violation, not a user input error.

Solutions

  1. Ensure the booking is persisted and its uid is set on the `CalendarEvent` before calling the video adapter.
  2. Add a type-level guarantee: make `uid` required on the event type passed to `createOrUpdateMeeting`.
  3. In the caller, fail fast with a clearer error if `event.uid` is missing before reaching the adapter.
  4. Fix the offending caller identified by the stack trace rather than mutating the adapter.

Example fix

// before
async function createOrUpdateMeeting(endpoint, event, region) {
  if (!event.uid) {
    throw new Error("We need need the booking uid to create the Daily reference in DB");
  }
  ...
}

// after
async function createOrUpdateMeeting(endpoint, event: CalendarEvent & { uid: string }, region) {
  const body = await translateEvent(event, region);
  ...
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (!event.uid) throw new Error("Cannot create Daily room: booking uid missing");

Type guard

function hasBookingUid(e: CalendarEvent): e is CalendarEvent & { uid: string } {
  return typeof e.uid === "string" && e.uid.length > 0;
}

Try / catch

if (!hasBookingUid(event)) {
  throw new Error("CalendarEvent missing required uid for video room creation");
}
await adapter.createMeeting(event);

Prevention

When it happens

Trigger: `createOrUpdateMeeting` (and thus `createMeeting`/`updateMeeting`) is invoked with a `CalendarEvent` whose `uid` is undefined — e.g. the event was constructed for a booking that hasn't been persisted yet (no uid assigned), or a code path calling the video adapter before the booking uid exists.

Common situations: Booking-creation pipeline calling the video adapter before the booking row (and uid) is committed; a test fixture that omits `uid`; reschedule flow passing a stale event object; refactor that stopped propagating `uid` into the `CalendarEvent`.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/320d71412705eeee. Report an issue: GitHub.

Appendix: source

Thrown at packages/app-store/dailyvideo/lib/VideoApiAdapter.ts:246

    where: {
      id: bookingReferenceId,
    },
    data: {
      meetingPassword: organizerMeetingToken.token,
    },
  });

  return organizerMeetingToken.token;
};

const DailyVideoApiAdapter = (): VideoApiAdapter => {
  async function createOrUpdateMeeting(
    endpoint: string,
    event: CalendarEvent,
    region?: RoomGeo
  ): Promise<VideoCallData> {
    if (!event.uid) {
      throw new Error("We need need the booking uid to create the Daily reference in DB");
    }
    const body = await translateEvent(event, region);
    const dailyEvent = await postToDailyAPI(endpoint, body).then(dailyReturnTypeSchema.parse);
    const meetingToken = await postToDailyAPI("/meeting-tokens", {
      properties: {
        room_name: dailyEvent.name,
        exp: dailyEvent.config.exp,
        is_owner: true,
        enable_recording_ui: false,
      },
    }).then(meetingTokenSchema.parse);

    return Promise.resolve({
      type: "daily_video",
      id: dailyEvent.name,
      password: meetingToken.token,
      url: dailyEvent.url,
    });

View on GitHub (pinned to 176037d0af)