Getting AxiosError: Request failed with status code 504 on Graph API request on Sunday only for selected users

66 Views Asked by At

I am getting multiple user's presence for teams using the Microsoft Graph API endpoint https://graph.microsoft.com/beta/communications/getPresencesByUserId.

I am getting an error as 'AxiosError: Request failed with status code 504' for the request to graph API to get user presence.

Found that this could be due to server overload, maintenance, or a temporary issue with the server.

FYI: Calling this API at a frequency of every 30 seconds/180 seconds. Error has been occurring for the last 2 weeks on Sundays only for a specific duration.

Code to call the API:

    let config = {
      method: "post",
      maxBodyLength: Infinity,
      url: "https://graph.microsoft.com/beta/communications/getPresencesByUserId",
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer " + accessToken,
      },
      data: data,
    };
    var requestDate = new Date();
    axios
      .request(config)
      .then((response) => {
       //some code
      })
      .catch((error) => { 
         //some code
      });

Can anyone please help me understand why this is occurring only on Sundays and what causing it?

Along with this, I have got AxiosError: Request failed with status code 502 for 1 or 2 times for the same request.

Thank You In advance

0

There are 0 best solutions below