GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: set creds only if transport not provided by ohmayr · Pull Request #1348 · googleapis/python-pubsub

This repository was archived by the owner on Oct 13, 2026. It is now read-only.

Conversation

@ohmayr

@ohmayr ohmayr commented Jan 23, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ohmayr
ohmayr requested review from a team January 23, 2025 16:24
@product-auto-label product-auto-label Bot added the size: xs Pull request size is extra small. label Jan 23, 2025
@blunderbuss-gcf blunderbuss-gcf Bot assigned mukund-ananthu Jan 23, 2025
@product-auto-label product-auto-label Bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Jan 23, 2025
@ohmayr
fix: set creds only if transport not provided
0f09432
@ohmayr
ohmayr force-pushed the set-creds-to-transport branch from 48a2676 to 0f09432 Compare January 23, 2025 16:29
@ohmayr ohmayr assigned parthea Jan 23, 2025
@ohmayr
link issue to move emulator code
7099d5e
@product-auto-label 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
parthea reviewed Jan 24, 2025
View reviewed changes
Comment thread google/cloud/pubsub_v1/publisher/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/pubsub_v1/services/publisher/client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ohmayr
address PR feedback
8f75047
@ohmayr
ohmayr force-pushed the set-creds-to-transport branch from 23d71e2 to 8f75047 Compare January 24, 2025 19:26
ohmayr added 2 commits January 24, 2025 19:28
@ohmayr
remove whitespace
88c4bc8
@ohmayr
add whitespace
0ac094a
@ohmayr
ohmayr requested a review from a team as a code owner January 24, 2025 22:49
@ohmayr
ohmayr requested a review from nicain January 24, 2025 22:49
@product-auto-label 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
move todo statement
361cacb
@ohmayr
ohmayr force-pushed the set-creds-to-transport branch from 173957a to 361cacb Compare January 27, 2025 16:30
@product-auto-label 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
ohmayr added 2 commits January 27, 2025 16:31
@ohmayr
add whitespace
2dfe399
@ohmayr
revert autogenerated changes
91b5b66
parthea
parthea approved these changes Jan 27, 2025
View reviewed changes
@mukund-ananthu
Merge branch 'main' into set-creds-to-transport
222a181
@ohmayr ohmayr mentioned this pull request Jan 28, 2025
fix: get channel target for a gRPC request #1339
Merged
@mukund-ananthu
mukund-ananthu merged commit 59965a4 into main Jan 29, 2025
@mukund-ananthu
mukund-ananthu deleted the set-creds-to-transport branch January 29, 2025 20:38
@release-please release-please Bot mentioned this pull request Jan 29, 2025
chore(main): release 2.28.0 #1351
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@nicain nicain Awaiting requested review from nicain nicain was automatically assigned from googleapis/python-samples-reviewers
1 more reviewer
@parthea parthea parthea approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@parthea parthea

@mukund-ananthu mukund-ananthu

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ohmayr @parthea @mukund-ananthu
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.