FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: set creds only if transport not provided by ohmayr · Pull Request #1348 · googleapis/python-pubsub · GitHub

This repository was archived by the owner on Mar 9, 2026. It is now read-only.
/ python-pubsub Public archive

fix: set creds only if transport not provided - #1348

Merged
mukund-ananthu merged 9 commits into
mainfrom
set-creds-to-transport
Jan 29, 2025
Merged

fix: set creds only if transport not provided#1348
mukund-ananthu merged 9 commits into
mainfrom
set-creds-to-transport

Conversation

ohmayr commented Jan 23, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

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 to AnonymousCredentials 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.

ohmayr requested review from a team January 23, 2025 16:24
product-auto-label Bot added the size: xs Pull request size is extra small. label Jan 23, 2025
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 48a2676 to 0f09432 Compare January 23, 2025 16:29
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
ohmayr force-pushed the set-creds-to-transport branch from 23d71e2 to 8f75047 Compare January 24, 2025 19:26
ohmayr requested a review from a team as a code owner January 24, 2025 22:49
ohmayr requested a review from nicain January 24, 2025 22:49
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 173957a to 361cacb Compare January 27, 2025 16:30
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
mukund-ananthu deleted the set-creds-to-transport branch January 29, 2025 20:38
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.

Labels

api: pubsub Issues related to the googleapis/python-pubsub API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL