Skip to content

Commit

Permalink
Website: Update Vanta integration script to retry failed requests to …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
eashaw authored Mar 18, 2024
1 parent 26965c8 commit d778328
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion website/scripts/send-data-to-vanta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
Expand Down

0 comments on commit d778328

Please sign in to comment.