From d7783286d3bda8c2dea32ba87134ba741093bea7 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 18 Mar 2024 17:45:07 -0500 Subject: [PATCH] Website: Update Vanta integration script to retry failed requests to Vanta's authorization endpoint. (#17704) Changes: - Chained a `.retry()` onto the post request that refreshes authorization tokens for Vanta connections, that will retry requests that return a `503 service unavailable` response. --- website/scripts/send-data-to-vanta.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/scripts/send-data-to-vanta.js b/website/scripts/send-data-to-vanta.js index 0615148239..d1c45193e8 100644 --- a/website/scripts/send-data-to-vanta.js +++ b/website/scripts/send-data-to-vanta.js @@ -34,7 +34,9 @@ module.exports = { grant_type: 'refresh_token',// eslint-disable-line camelcase }, headers: { accept: 'application/json' } - }).tolerate((err)=>{ + }) + .retry({raw:{statusCode: 503}}) + .tolerate((err)=>{ // If an error occurs while sending a request to Vanta, we'll add the error to the errorReportById object, with this connections ID set as the key. errorReportById[connectionIdAsString] = new Error(`Could not refresh the token for Vanta connection (id: ${connectionIdAsString}). Full error: ${err}`); });