fix: resolve MS Teams booking confirmation failure (HTTP 524) in v6.2#28810
fix: resolve MS Teams booking confirmation failure (HTTP 524) in v6.2#28810saagnik23 wants to merge 2 commits intocalcom:mainfrom
Conversation
📝 WalkthroughWalkthroughThe pull request modifies the Teams and video call URL selection logic in 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/features/bookings/lib/service/RegularBookingService.ts`:
- Around line 2214-2234: The code still prefers a generic provider's URL because
createdOrUpdatedEvent is seeded from results[0] and videoCallUrl prefers
metadata.hangoutLink before Teams; update the selection logic so that if a
teamsResult (type "office365_video") exists you derive
createdOrUpdatedEvent/teamsUpdatedEvent and metadata fields from that
teamsResult first (falling back to results[0] only if no teamsResult), and
change the videoCallUrl precedence to prefer teamsJoinUrl
(teamsUpdatedEvent?.url or teamsResult?.createdEvent?.url) before
metadata.hangoutLink and createdOrUpdatedEvent?.url; apply the same change to
the other block referenced (around the 2349-2364 area) so mixed-provider arrays
always prefer the Teams result when present.
- Around line 2218-2220: The warning branch using teamsResult and
results.some(...) is dead code because both checks use the same predicate;
replace the current condition with a check that Teams was actually expected for
this booking (e.g., use the booking-level flag or metadata that indicates a
Teams/office365_video meeting such as booking.expectedVideoPlatform,
booking.shouldIncludeTeams, or similar) and only then log via tracingLogger.warn
if teamsResult is missing; update the duplicate logic at the other occurrence
(lines referenced around the second block) to use the same expectation-based
gating rather than re-checking the results array.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2dd8ae39-2071-4544-a939-3e6f972c8a6b
📒 Files selected for processing (1)
packages/features/bookings/lib/service/RegularBookingService.ts
Summary
Fixes the Microsoft Teams booking confirmation failure introduced in v6.2.
Closes #28775
Related to #28555, #28689
Root Cause
The v6.2 Calendar Sync refactor changed
RegularBookingService.tstoreturn a
resultsarray that can include entries from multiple calendarintegrations (Google Cal, iCal, CalDAV, MS Teams, etc.) in variable order.
Code that previously hardcoded
results[0]to look up the MS Teams(
office365_video) credential/event reference now silently gets thewrong entry — or none — when another calendar integration appears first
in the array. This causes a server-side crash and HTTP 524, which the
frontend receives as an HTML error page instead of JSON, producing the
"Unexpected token '<', <!DOCTYPE is not valid JSON" error.
Fix
Replace hardcoded
results[0]with a dynamic.find()scoped to theoffice365_videoprovider type:Before:
After:
This is consistent with the approach taken in PR #28689 for #28555
(Google Meet
videoCallUrlmissing), which fixed the same class ofregression for a different provider.
Testing
References