{"record":{"id":"320d71412705eeee","repo":"calcom/cal.diy","slug":"we-need-need-the-booking-uid-to-create-the-daily-r","errorCode":null,"errorMessage":"We need need the booking uid to create the Daily reference in DB","messagePattern":"We need need the booking uid to create the Daily reference in DB","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-store/dailyvideo/lib/VideoApiAdapter.ts","lineNumber":246,"sourceCode":"    where: {\n      id: bookingReferenceId,\n    },\n    data: {\n      meetingPassword: organizerMeetingToken.token,\n    },\n  });\n\n  return organizerMeetingToken.token;\n};\n\nconst DailyVideoApiAdapter = (): VideoApiAdapter => {\n  async function createOrUpdateMeeting(\n    endpoint: string,\n    event: CalendarEvent,\n    region?: RoomGeo\n  ): Promise<VideoCallData> {\n    if (!event.uid) {\n      throw new Error(\"We need need the booking uid to create the Daily reference in DB\");\n    }\n    const body = await translateEvent(event, region);\n    const dailyEvent = await postToDailyAPI(endpoint, body).then(dailyReturnTypeSchema.parse);\n    const meetingToken = await postToDailyAPI(\"/meeting-tokens\", {\n      properties: {\n        room_name: dailyEvent.name,\n        exp: dailyEvent.config.exp,\n        is_owner: true,\n        enable_recording_ui: false,\n      },\n    }).then(meetingTokenSchema.parse);\n\n    return Promise.resolve({\n      type: \"daily_video\",\n      id: dailyEvent.name,\n      password: meetingToken.token,\n      url: dailyEvent.url,\n    });","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/packages/app-store/dailyvideo/lib/VideoApiAdapter.ts#L228-L264","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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`.","solutions":["Ensure the booking is persisted and its uid is set on the `CalendarEvent` before calling the video adapter.","Add a type-level guarantee: make `uid` required on the event type passed to `createOrUpdateMeeting`.","In the caller, fail fast with a clearer error if `event.uid` is missing before reaching the adapter.","Fix the offending caller identified by the stack trace rather than mutating the adapter."],"exampleFix":"// before\nasync function createOrUpdateMeeting(endpoint, event, region) {\n  if (!event.uid) {\n    throw new Error(\"We need need the booking uid to create the Daily reference in DB\");\n  }\n  ...\n}\n\n// after\nasync function createOrUpdateMeeting(endpoint, event: CalendarEvent & { uid: string }, region) {\n  const body = await translateEvent(event, region);\n  ...\n}","handlingStrategy":"type-guard","validationCode":"if (!event.uid) throw new Error(\"Cannot create Daily room: booking uid missing\");","typeGuard":"function hasBookingUid(e: CalendarEvent): e is CalendarEvent & { uid: string } {\n  return typeof e.uid === \"string\" && e.uid.length > 0;\n}","tryCatchPattern":"if (!hasBookingUid(event)) {\n  throw new Error(\"CalendarEvent missing required uid for video room creation\");\n}\nawait adapter.createMeeting(event);","preventionTips":["Persist the booking and set `uid` on the event before calling the video adapter.","Make `uid` required in the event type passed to create/updateMeeting.","Add unit tests asserting the adapter is only called with a uid.","Fail fast in the booking pipeline if uid is unassigned."],"tags":["video","daily","booking","contract","programming-error"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}