You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has happened before, I gave up trying to solve it, and when I came back it wasn't happening anymore. But now it happened again and I can't solve it. The server action doesn't seem to be called, even with a console log on the client before calling it, it works.
It was working normally, I made a repetition error in rendering and the screen was freezing, when I resolved it it appeared.
Additional information
// Use clientuseEffect(()=>{console.log("entered useEffect");// OKif(!eventRange)return;if(isLoading)return;setIsLoading(true);console.log("will call server action");// OKgetCalendarEvents(currentAgenda.id||"",eventRange?.start.toISOString(),eventRange?.end.toISOString())...},[currentAgenda.id,eventRange]);// Server action"use server";
...
constcalendar=google.calendar("v3");exporttypeCalendar=calendar_v3.Schema$CalendarListEntry;exporttypeCalendarInsert=calendar_v3.Params$Resource$Calendars$Insert;exporttypeCalendarEvent=calendar_v3.Schema$Event;exporttypeCalendarEventInsert=calendar_v3.Params$Resource$Events$Insert;/** * Helper function to handle common Google API call logic including authentication and error handling. * @param userId - The ID of the user. * @param operation - The actual Google Calendar API operation to perform. * @param errorMessagePrefix - Prefix for error messages logged to console. * @returns A promise that resolves to the result of the API operation. */asyncfunctionexecuteGoogleApiCall<T>(userId: string|undefined,operation: (auth: InstanceType<typeofgoogle.auth.OAuth2>,calendarClient: calendar_v3.Calendar)=>Promise<T>,errorMessagePrefix: string){
...
}/** * Retrieves events from a specified Google Calendar for a given user. * @param calendarId - The ID of the calendar to fetch events from. * @param userId - Optional user ID. If not provided, the current user's ID will be used. * @param timeMin - Optional ISO string to filter events that start after this time. * @param timeMax - Optional ISO string to filter events that end before this time. * @returns A promise that resolves to an array of calendar events or undefined. * @throws Error if user authentication fails, tokens are invalid, or there's an API error. */exportasyncfunctiongetCalendarEvents(calendarId: string,timeMin?: string,timeMax?: string,userId?: string): Promise<CalendarEvent[]|undefined>{
console.log("called on server action");// NOT OKreturnexecuteGoogleApiCall(userId,async(auth,calendarClient)=>{console.log("Fetching events from Google Calendar API...",calendarId,userId,timeMin,timeMax);constparams: any={ auth, calendarId };if(timeMin)params.timeMin=timeMin;if(timeMax)params.timeMax=timeMax;constresponse=awaitcalendarClient.events.list({ ...params});returnresponse.data.items;},"Erro ao buscar eventos da agenda");}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This has happened before, I gave up trying to solve it, and when I came back it wasn't happening anymore. But now it happened again and I can't solve it. The server action doesn't seem to be called, even with a console log on the client before calling it, it works.
It was working normally, I made a repetition error in rendering and the screen was freezing, when I resolved it it appeared.
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions