Skip to content

Commit 6f1c209

Browse files
fix: handle fallback option properly (#284)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore(nodejs_templates): add script logging to node_library populate-secrets.sh Co-authored-by: Benjamin E. Coe <[email protected]> Source-Author: BenWhitehead <[email protected]> Source-Date: Wed Jun 10 22:24:28 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: e7034945fbdc0e79d3c57f6e299e5c90b0f11469 Source-Link: googleapis/synthtool@e703494
1 parent de729e9 commit 6f1c209

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

packages/google-cloud-securitycenter/src/v1/security_center_client.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,11 @@ export class SecurityCenterClient {
110110
// const showcaseClient = new showcaseClient({ projectId, customConfig });
111111
opts.clientConfig = opts.clientConfig || {};
112112

113-
const isBrowser = typeof window !== 'undefined';
114-
if (isBrowser) {
115-
opts.fallback = true;
116-
}
117-
// If we are in browser, we are already using fallback because of the
118-
// "browser" field in package.json.
119-
// But if we were explicitly requested to use fallback, let's do it now.
120-
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
113+
// If we're running in browser, it's OK to omit `fallback` since
114+
// google-gax has `browser` field in its `package.json`.
115+
// For Electron (which does not respect `browser` field),
116+
// pass `{fallback: true}` to the SecurityCenterClient constructor.
117+
this._gaxModule = opts.fallback ? gax.fallback : gax;
121118

122119
// Create a `gaxGrpc` object, with any grpc-specific options
123120
// sent to the client.

packages/google-cloud-securitycenter/src/v1beta1/security_center_client.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,11 @@ export class SecurityCenterClient {
110110
// const showcaseClient = new showcaseClient({ projectId, customConfig });
111111
opts.clientConfig = opts.clientConfig || {};
112112

113-
const isBrowser = typeof window !== 'undefined';
114-
if (isBrowser) {
115-
opts.fallback = true;
116-
}
117-
// If we are in browser, we are already using fallback because of the
118-
// "browser" field in package.json.
119-
// But if we were explicitly requested to use fallback, let's do it now.
120-
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
113+
// If we're running in browser, it's OK to omit `fallback` since
114+
// google-gax has `browser` field in its `package.json`.
115+
// For Electron (which does not respect `browser` field),
116+
// pass `{fallback: true}` to the SecurityCenterClient constructor.
117+
this._gaxModule = opts.fallback ? gax.fallback : gax;
121118

122119
// Create a `gaxGrpc` object, with any grpc-specific options
123120
// sent to the client.

packages/google-cloud-securitycenter/src/v1p1beta1/security_center_client.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,11 @@ export class SecurityCenterClient {
110110
// const showcaseClient = new showcaseClient({ projectId, customConfig });
111111
opts.clientConfig = opts.clientConfig || {};
112112

113-
const isBrowser = typeof window !== 'undefined';
114-
if (isBrowser) {
115-
opts.fallback = true;
116-
}
117-
// If we are in browser, we are already using fallback because of the
118-
// "browser" field in package.json.
119-
// But if we were explicitly requested to use fallback, let's do it now.
120-
this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax;
113+
// If we're running in browser, it's OK to omit `fallback` since
114+
// google-gax has `browser` field in its `package.json`.
115+
// For Electron (which does not respect `browser` field),
116+
// pass `{fallback: true}` to the SecurityCenterClient constructor.
117+
this._gaxModule = opts.fallback ? gax.fallback : gax;
121118

122119
// Create a `gaxGrpc` object, with any grpc-specific options
123120
// sent to the client.

packages/google-cloud-securitycenter/synth.metadata

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/nodejs-security-center.git",
7-
"sha": "20e4b1e59990902c7d48310fd452d8709d63743c"
7+
"sha": "41bd2a92dbed2041ef5d5def1b3ce0c22b670b12"
88
}
99
},
1010
{
@@ -19,7 +19,7 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "1c92077459db3dc50741e878f98b08c6261181e0"
22+
"sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469"
2323
}
2424
}
2525
],

0 commit comments

Comments
 (0)