Express App and Google Calendar API integration (Workspace)

Hi, I have a problem, I’ve created an express app integration with Google Calendar API (Google Workspace). Authenticates using the googleapis and google-auth-library package. Then I create an event and send it to Google Calendar. Most of the time it works fine and creates a calendar event.

1/10 of the cases end up with the following error: “Invalid response body while trying to fetch https://www.googleapis.com/oauth2/v4/token: read ECONNRESET…”

Why does it work sometimes and sometimes it doesn’t? How can I increase the reliability of my service?

I found the cause of the error. The error occurs every time the node server is reset. Probably the problem is with the timeout for authorizations.

Solution - initiate authorization with google before first request.