diff --git a/packages/google-cloud-bigquery-storage/src/v1/big_query_read_client.ts b/packages/google-cloud-bigquery-storage/src/v1/big_query_read_client.ts index f25c074a4f8..02d1095fa44 100644 --- a/packages/google-cloud-bigquery-storage/src/v1/big_query_read_client.ts +++ b/packages/google-cloud-bigquery-storage/src/v1/big_query_read_client.ts @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1/big_query_read_client_config.json`. @@ -138,22 +139,7 @@ export class BigQueryReadClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-bigquery-storage/src/v1beta1/big_query_storage_client.ts b/packages/google-cloud-bigquery-storage/src/v1beta1/big_query_storage_client.ts index 4defcb909f4..d779c6da55c 100644 --- a/packages/google-cloud-bigquery-storage/src/v1beta1/big_query_storage_client.ts +++ b/packages/google-cloud-bigquery-storage/src/v1beta1/big_query_storage_client.ts @@ -22,6 +22,7 @@ import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1beta1/big_query_storage_client_config.json`. @@ -138,22 +139,7 @@ export class BigQueryStorageClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API.