-
Notifications
You must be signed in to change notification settings - Fork 207
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: set creds only if transport not provided #1348
Merged
Merged
Conversation
This file contains 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
product-auto-label
bot
added
the
api: pubsub
Issues related to the googleapis/python-pubsub API.
label
Jan 23, 2025
ohmayr
force-pushed
the
set-creds-to-transport
branch
from
January 23, 2025 16:29
48a2676
to
0f09432
Compare
product-auto-label
bot
added
size: s
Pull request size is small.
and removed
size: xs
Pull request size is extra small.
labels
Jan 24, 2025
parthea
reviewed
Jan 24, 2025
ohmayr
force-pushed
the
set-creds-to-transport
branch
from
January 24, 2025 19:26
23d71e2
to
8f75047
Compare
product-auto-label
bot
added
size: xl
Pull request size is extra large.
and removed
size: s
Pull request size is small.
labels
Jan 24, 2025
ohmayr
force-pushed
the
set-creds-to-transport
branch
from
January 27, 2025 16:30
173957a
to
361cacb
Compare
product-auto-label
bot
added
size: s
Pull request size is small.
and removed
size: xl
Pull request size is extra large.
labels
Jan 27, 2025
parthea
approved these changes
Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
GAPICs are designed to allow users to only configure one of transport or credentials. If a transport is configured explicitly, then it must be instantiated with credentials.
gapic-generator: See: https://github.com/googleapis/gapic-generator-python/blob/main/gapic/templates/%25namespace/%25name_%25version/%25sub/services/%25service/client.py.j2#L563.
pubsub: https://github.com/googleapis/python-pubsub/blob/main/google/pubsub_v1/services/publisher/client.py#L678
in google.cloud.pubsub_v1, if the environment variable
PUBSUB_EMULATOR_HOST
is set, the credentials are automatically set toAnonymousCredentials
in the client layer.This means that if
PUBSUB_EMULATOR_HOST
is set, then credentials are automatically configured under the hood for test cases.This behaviour results in an issue if a test sets
PUBSUB_EMULATOR_HOST
explicitly and provides a transport to a client, resulting in the following error to be raised https://github.com/googleapis/python-pubsub/blob/main/google/pubsub_v1/services/publisher/client.py#L678.Given that we want to update the following test to explicitly configure a transport to the client (with an intercept channel), we want to make sure that credentials are provided to the transport instance and not on the client instance directly.