Skip to content

Commit

Permalink
fix: Support 404 When GaxiosError != GaxiosError (#1707)
Browse files Browse the repository at this point in the history
* fix: Support 404 When GaxiosError != GaxiosError

* fix: optionalize

* refactor: Even more robust for `GaxiosError` != `GaxiosError`

Older versions of gaxios may not have `.status`, but only `.response.status`
  • Loading branch information
d-goog authored Dec 1, 2023
1 parent e8966d1 commit 704674f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"gaxios": "^6.0.0",
"gaxios": "^6.1.1",
"gcp-metadata": "^6.1.0",
"gtoken": "^7.0.0",
"jws": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/auth/googleauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export class GoogleAuth<T extends AuthClient = JSONClient> {
universeDomain = await gcpMetadata.universe('universe_domain');
universeDomain ||= DEFAULT_UNIVERSE;
} catch (e) {
if (e instanceof GaxiosError && e.status === 404) {
if (e && (e as GaxiosError)?.response?.status === 404) {
universeDomain = DEFAULT_UNIVERSE;
} else {
throw e;
Expand Down

0 comments on commit 704674f

Please sign in to comment.