diff --git a/src/fallback.ts b/src/fallback.ts index 19c5cbfcd..aae307ab0 100644 --- a/src/fallback.ts +++ b/src/fallback.ts @@ -28,7 +28,6 @@ import { GoogleAuthOptions, BaseExternalAccountClient, } from 'google-auth-library'; -import * as objectHash from 'object-hash'; import {OperationsClientBuilder} from './operationsClient'; import {GrpcClientOptions, ClientStubOptions} from './grpc'; import {GaxCall, GRPCCall} from './apitypes'; @@ -40,6 +39,7 @@ import * as fallbackRest from './fallbackRest'; import {isNodeJS} from './featureDetection'; import {generateServiceStub} from './fallbackServiceStub'; import {StreamType} from '.'; +import * as objectHash from 'object-hash'; export {FallbackServiceError}; export {PathTemplate} from './pathTemplate'; @@ -135,7 +135,7 @@ export class GrpcClient { } loadProtoJSON(json: protobuf.INamespace, ignoreCache = false) { - const hash = objectHash(json).toString(); + const hash = objectHash(JSON.stringify(json)).toString(); const cached = GrpcClient.protoCache.get(hash); if (cached && !ignoreCache) { return cached; diff --git a/src/grpc.ts b/src/grpc.ts index 177781456..ac2f6469d 100644 --- a/src/grpc.ts +++ b/src/grpc.ts @@ -292,7 +292,7 @@ export class GrpcClient { } loadProtoJSON(json: protobuf.INamespace, ignoreCache = false) { - const hash = objectHash(json).toString(); + const hash = objectHash(JSON.stringify(json)).toString(); const cached = GrpcClient.protoCache.get(hash); if (cached && !ignoreCache) { return cached; diff --git a/test/fixtures/google-gax-packaging-test-app/test/gapic-v1beta1.ts b/test/fixtures/google-gax-packaging-test-app/test/gapic-v1beta1.ts index 01b52da86..9ce1307a0 100644 --- a/test/fixtures/google-gax-packaging-test-app/test/gapic-v1beta1.ts +++ b/test/fixtures/google-gax-packaging-test-app/test/gapic-v1beta1.ts @@ -357,7 +357,7 @@ describe('v1beta1.EchoClient', () => { ); }); - it.only('invokes echo with closed client', async () => { + it('invokes echo with closed client', async () => { const client = new echoModule.v1beta1.EchoClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus',