Skip to content

Commit

Permalink
fix: Disable Universe Domain Check
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbankhead committed Oct 3, 2024
1 parent 66f60bc commit c69cb93
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
6 changes: 0 additions & 6 deletions src/auth/googleauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,6 @@ export class GoogleAuth<T extends AuthClient = JSONClient> {

// Determine if we're running on GCE.
if (await this._checkIsGCE()) {
// set universe domain for Compute client
if (!originalOrCamelOptions(options).get('universe_domain')) {
options.universeDomain =
await this.getUniverseDomainFromMetadataServer();
}

(options as ComputeOptions).scopes = this.getAnyScopes();
return await this.#prepareAndCacheClient(new Compute(options));
}
Expand Down
12 changes: 1 addition & 11 deletions test/test.googleauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,9 +1149,8 @@ describe('googleauth', () => {

it('getCredentials should get metadata from the server when running on GCE', async () => {
const clientEmail = 'test-creds@test-creds.iam.gserviceaccount.com';
const universeDomain = 'my-amazing-universe.com';
const scopes = [
nockIsGCE({universeDomain}),
nockIsGCE(),
createGetProjectIdNock(),
nock(host).get(svcAccountPath).reply(200, clientEmail, HEADERS),
];
Expand All @@ -1160,7 +1159,6 @@ describe('googleauth', () => {
const body = await auth.getCredentials();
assert.ok(body);
assert.strictEqual(body.client_email, clientEmail);
assert.strictEqual(body.universe_domain, universeDomain);
assert.strictEqual(body.private_key, undefined);
scopes.forEach(s => s.done());
});
Expand Down Expand Up @@ -1644,14 +1642,6 @@ describe('googleauth', () => {
assert.notEqual(universe_domain, DEFAULT_UNIVERSE);
assert.equal(await auth.getUniverseDomain(), universe_domain);
});

it('should use the metadata service if on GCP', async () => {
const universeDomain = 'my.universe.com';
const scope = nockIsGCE({universeDomain});

assert.equal(await auth.getUniverseDomain(), universeDomain);
await scope.done();
});
});

function mockApplicationDefaultCredentials(path: string) {
Expand Down

0 comments on commit c69cb93

Please sign in to comment.