fix: add debug logging for Outlook recurring event updates
Log the event ID decomposition, update payload, and Graph API response status to diagnose why recurring event updates aren't persisting for Outlook. v1.74.8 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
59778d34fa
commit
11e7b14c17
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.74.7",
|
||||
"version": "1.74.8",
|
||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -1140,6 +1140,8 @@ export const updateCalendarEvent = async (
|
||||
|
||||
// Extract base series ID for Outlook
|
||||
const baseEventId = eventId.includes('::') ? eventId.split('::')[0] : eventId;
|
||||
console.log(`[OUTLOOK] Updating event: originalId=${eventId}, baseEventId=${baseEventId}`);
|
||||
console.log(`[OUTLOOK] Update payload: start=${JSON.stringify(event.start)}, end=${JSON.stringify(event.end)}, title=${event.title}`);
|
||||
|
||||
const startDate = event.start?.dateTime ? new Date(event.start.dateTime) : new Date();
|
||||
const outlookUpdateTz = event.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
||||
|
||||
@ -387,6 +387,8 @@ export const updateEvent = async (
|
||||
} : {}),
|
||||
});
|
||||
|
||||
console.log(`[OUTLOOK] updateEvent request body:`, body);
|
||||
|
||||
const patchHeaders: Record<string, string> = {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
@ -400,16 +402,19 @@ export const updateEvent = async (
|
||||
let response = await fetch(`${GRAPH_ENDPOINT}/me/events/${encodedEventId}`, {
|
||||
method: 'PATCH', headers: patchHeaders, body
|
||||
});
|
||||
console.log(`[OUTLOOK] PATCH /me/events/${eventId.slice(-20)} → ${response.status}`);
|
||||
|
||||
if (!response.ok && (response.status === 404 || response.status === 400)) {
|
||||
// Fallback: try calendar-scoped endpoint
|
||||
response = await fetch(`${GRAPH_ENDPOINT}/me/calendars/${encodedCalendarId}/events/${encodedEventId}`, {
|
||||
method: 'PATCH', headers: patchHeaders, body
|
||||
});
|
||||
console.log(`[OUTLOOK] PATCH fallback /me/calendars/.../events/${eventId.slice(-20)} → ${response.status}`);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
const err = await response.text();
|
||||
console.error(`[OUTLOOK] Update failed:`, err);
|
||||
throw new Error(`Failed to update Outlook event: ${err}`);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user