Skip to content
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: throw when adc cannot acquire a projectId #658

Merged
merged 3 commits into from Apr 2, 2019
Merged

Conversation

JustinBeckwith
Copy link
Contributor

BREAKING CHANGE Currently, when a user is using application default credentials, and they call auth.getProjectId, we check a variety of sources, and return the first projectId we find. In the event of none - we return null. This PR changes the behavior, so instead of returning null, we throw an exception.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 29, 2019
@codecov
Copy link

codecov bot commented Mar 30, 2019

Codecov Report

Merging #658 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #658      +/-   ##
==========================================
+ Coverage   88.12%   88.25%   +0.12%     
==========================================
  Files          18       18              
  Lines         783      783              
  Branches       84       84              
==========================================
+ Hits          690      691       +1     
+ Misses         82       81       -1     
  Partials       11       11
Impacted Files Coverage Δ
src/auth/googleauth.ts 91.28% <100%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec56c88...db8292b. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 30, 2019

Codecov Report

Merging #658 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #658      +/-   ##
==========================================
+ Coverage   88.12%   88.25%   +0.12%     
==========================================
  Files          18       18              
  Lines         783      783              
  Branches       84       84              
==========================================
+ Hits          690      691       +1     
+ Misses         82       81       -1     
  Partials       11       11
Impacted Files Coverage Δ
src/auth/googleauth.ts 91.28% <100%> (+0.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48a1c81...b0fa725. Read the comment docs.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot 👍

await this.getFileProjectId() ||
await this.getDefaultServiceProjectId() ||
await this.getGCEProjectId();
this._cachedProjectId = projectId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this addition, I'd way rather the library fail early than run in an undefined state with no project ID.

@JustinBeckwith
Copy link
Contributor Author

image

@JustinBeckwith JustinBeckwith merged commit ba48164 into master Apr 2, 2019
@JustinBeckwith JustinBeckwith deleted the throwy branch April 13, 2019 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants