This repository was archived by the owner on Mar 4, 2026. It is now read-only.
fix: prevent unhandled promise rejections while creating session#1332
Merged
skuruppu merged 3 commits intogoogleapis:masterfrom Apr 6, 2021
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1332 +/- ##
=======================================
Coverage 98.60% 98.60%
=======================================
Files 23 23
Lines 21923 21942 +19
Branches 1226 1229 +3
=======================================
+ Hits 21617 21636 +19
Misses 297 297
Partials 9 9
Continue to review full report at Codecov.
|
skuruppu
approved these changes
Apr 6, 2021
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here is the different scenarios on how it handles the exception.
Non existing Table:
5 NOT_FOUND: Table not found: fake-table-nameProperly Handles the exception.
Non existing Database:
5 NOT_FOUND: Database not found: projects/existing-project/instances/existing-instance/databases/fake-database-idProperly Handles the exception.
Non existing Instance:
5 NOT_FOUND: Instance not found: projects/existing-project/instances/fake-instance-idProperly Handles the exception.
Non existing Project:
7 PERMISSION_DENIED: Caller is missing IAM permission spanner.sessions.create on resource projects/fake-projectId/instances/existing-instance-id/databases/existing-database-id.It gives the error as well as throws
UnhandledPromiseRejectionWarningexception.While creating the session if Project doesn't exists it gives the above error as well has throws the
UnhandledPromiseRejectionWarningexception.Propose Implementation:
stop re-emitting the
spanner.sessions.createpermission error.Fixes #1319
It also triggers two more unhandled promise rejection:
Could not load the default credentialswhile default credentials not set.Unable to detect a Project Id in the current environmentwhile projectId not set.I have added separate issue #1333 for same.