fix: Correctly catch DefaultCredentialsError when looking up project_id by jonathanedey · Pull Request #720 · firebase/firebase-admin-python
DefaultCredentialsError was not being caught when trying to load project_id from credentials.
Added a catch for this error along with unit tests.
Related: #609
jonathanedey
changed the title
fix: Correctly catch DefaultCredentialsError when looking up prodject_id
fix: Correctly catch DefaultCredentialsError when looking up project_id
| project_id = self._credential.project_id | ||
| except AttributeError: | ||
| except (AttributeError, DefaultCredentialsError): | ||
| pass |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to throw here or pass?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to pass and look for other ways of getting a project_id.
Noticed that I am not explicitly triggering the exceptions in the unit tests. Doing that caught that I also needed to clear gcloud env to ensure the exception is thrown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters