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.
This commit is contained in:
Eric 2024-03-18 17:45:07 -05:00 committed by GitHub
parent 26965c8ae9
commit d7783286d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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}`);
});