-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Requests Respect config.projectIdRequired
=== false
#753
Conversation
src/util.ts
Outdated
projectId = await authClient.getProjectId(); | ||
|
||
authenticatedReqOpts = util.decorateRequest( | ||
authenticatedReqOpts!, | ||
projectId | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking for the projectId
as a fallback when it is not available to preserve existing behavior. Currently, consumers may not expect projectIdRequired
to affect things at the request level - this is here to ensure backwards compatibility. Cases:
- this block is not called (skips
catch
block): API is fullyprojectId
-free. - this is called (is caught): since the
projectId
was not checked before, this preserves that call. Net = 0 new calls are made
onAuthenticated(null, authorizedReqOpts as DecorateRequestOptions); | ||
}) | ||
.catch(onAuthenticated); | ||
const prepareRequest = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expanded this block for readability.
config.projectIdRequired
=== false
config.projectIdRequired
=== false
Overall I think the code changes look good. However, what is the plan for testing this as to not potentially impact consumers in case this causes unforeseen issues? |
@ddelgrosso1 I think this is overall safe - here's an overview:
Additionally, all API calls are in the same order as before |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks for upstreaming this work @danielbankhead 👏
Will defer to @ddelgrosso1 for review.
Fixes #711 🦕
Important: Will need to port fix to https://github.com/googleapis/nodejs-storage/