@google-cloud/common
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -325,2 +325,3 @@ "use strict"; | ||
let stream; | ||
let projectId; | ||
const reqConfig = extend({}, config); | ||
@@ -344,7 +345,2 @@ let activeRequest_; | ||
if (!err || autoAuthFailed) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
let projectId = authClient._cachedProjectId; | ||
if (config.projectId && config.projectId !== '{{projectId}}') { | ||
projectId = config.projectId; | ||
} | ||
try { | ||
@@ -389,15 +385,19 @@ authenticatedReqOpts = util.decorateRequest(authenticatedReqOpts, projectId); | ||
}; | ||
if (reqConfig.customEndpoint) { | ||
// Using a custom API override. Do not use `google-auth-library` for | ||
// authentication. (ex: connecting to a local Datastore server) | ||
onAuthenticated(null, reqOpts); | ||
} | ||
else { | ||
authClient.authorizeRequest(reqOpts).then(res => { | ||
const opts = extend(true, {}, reqOpts, res); | ||
onAuthenticated(null, opts); | ||
}, err => { | ||
onAuthenticated(err); | ||
}); | ||
} | ||
Promise.all([ | ||
config.projectId && config.projectId !== '{{projectId}}' | ||
? // The user provided a project ID. We don't need to check with the | ||
// auth client, it could be incorrect. | ||
new Promise(resolve => resolve(config.projectId)) | ||
: authClient.getProjectId(), | ||
reqConfig.customEndpoint | ||
? // Using a custom API override. Do not use `google-auth-library` for | ||
// authentication. (ex: connecting to a local Datastore server) | ||
new Promise(resolve => resolve(reqOpts)) | ||
: authClient.authorizeRequest(reqOpts), | ||
]) | ||
.then(([_projectId, authorizedReqOpts]) => { | ||
projectId = _projectId; | ||
onAuthenticated(null, authorizedReqOpts); | ||
}) | ||
.catch(onAuthenticated); | ||
if (stream) { | ||
@@ -404,0 +404,0 @@ return stream; |
@@ -7,2 +7,9 @@ # Changelog | ||
### [3.7.1](https://www.github.com/googleapis/nodejs-common/compare/v3.7.0...v3.7.1) (2021-08-06) | ||
### Bug Fixes | ||
* correctly locate projectId from auth library ([#663](https://www.github.com/googleapis/nodejs-common/issues/663)) ([72e3168](https://www.github.com/googleapis/nodejs-common/commit/72e3168bcac1d177360257197293a566c5fb63d3)) | ||
## [3.7.0](https://www.github.com/googleapis/nodejs-common/compare/v3.6.0...v3.7.0) (2021-07-09) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/common", | ||
"description": "Common components for Cloud APIs Node.js Client Libraries", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google Inc.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123105