Skip to content

Commit f6454e0

Browse files
fix: handle fallback option properly (#425)
* 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 55ea625 commit f6454e0

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

packages/google-cloud-tasks/src/v2/cloud_tasks_client.ts

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

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

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

packages/google-cloud-tasks/src/v2beta2/cloud_tasks_client.ts

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

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

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

packages/google-cloud-tasks/src/v2beta3/cloud_tasks_client.ts

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

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

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

packages/google-cloud-tasks/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-tasks.git",
7-
"sha": "ad876bca51afe0e69e41f436208f93f81a5dff67"
7+
"sha": "b2b7fd3103afb35972e2c58f302a93e15abaa761"
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)