diff --git a/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js b/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js index 52c22ca7ca87e..7e08286af4645 100644 --- a/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js +++ b/packages/gatsby-plugin-benchmark-reporting/src/gatsby-node.js @@ -249,17 +249,17 @@ class BenchMeta { method: `POST`, headers: { "content-type": `application/json`, - // "user-agent": this.getUserAgent(), + "x-benchmark-secret": process.env.BENCHMARK_REPORTING_SECRET, }, body: json, }).then(res => { lastStatus = res.status - if (lastStatus === 500) { - reportInfo(`Got 500 response, waiting for text`) + if ([401, 500].includes(lastStatus)) { + reportInfo(`Got ${lastStatus} response, waiting for text`) res.text().then(content => { reportError( `Response error`, - new Error(`Server responded with a 500 error: ${content}`) + new Error(`Server responded with a ${lastStatus} error: ${content}`) ) process.exit(1) })