diff --git a/packages/apollo-gateway/src/loadServicesFromStorage.ts b/packages/apollo-gateway/src/loadServicesFromStorage.ts index e42f1aed2fa..48a294e8a28 100644 --- a/packages/apollo-gateway/src/loadServicesFromStorage.ts +++ b/packages/apollo-gateway/src/loadServicesFromStorage.ts @@ -80,15 +80,16 @@ function fetchApolloGcs( // Google Cloud Storage returns an `application/xml` error under error // conditions. We'll special-case our known errors, and resort to // printing the body for others. - if ( - response.headers.get('content-type') === 'application/xml' && - response.status === 403 && - body.includes("AccessDenied") && - body.includes("Anonymous caller does not have storage.objects.get") - ) { - throw new Error( - Unable to authenticate with Apollo Graph Manager storage " + - "while fetching " + url); + if (response.headers.get('content-type') === 'application/xml') { + if ( + response.status === 403 && + body.includes("AccessDenied") && + body.includes("Anonymous caller does not have storage.objects.get") + ) { + throw new Error( + "Unable to authenticate with Apollo Graph Manager storage " + + "while fetching " + url); + } } // Normally, we'll try to keep the logs clean with errors we expect.