Skip to content

Commit

Permalink
Update packages/apollo-gateway/src/loadServicesFromStorage.ts
Browse files Browse the repository at this point in the history
Co-Authored-By: Trevor Scheer <[email protected]>
  • Loading branch information
abernix and trevor-scheer authored Mar 4, 2020
1 parent 03038e3 commit 4d4ab5b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/apollo-gateway/src/loadServicesFromStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,15 @@ 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') {
if (
response.status === 403 &&
body.includes("<Error><Code>AccessDenied</Code>") &&
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' &&
response.status === 403 &&
body.includes("<Error><Code>AccessDenied</Code>") &&
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.
Expand Down

0 comments on commit 4d4ab5b

Please sign in to comment.