Skip to content
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

[Bug]: PubsubIO/PubsubLiteIO is not using the gcp credential set in the PipelineOption #28286

Closed
3 of 15 tasks
ns-ydai opened this issue Sep 1, 2023 · 6 comments
Closed
3 of 15 tasks

Comments

@ns-ydai
Copy link

ns-ydai commented Sep 1, 2023

What happened?

My dataflow job is running in Project A, and it needs to use service account which belongs to Project B to read the Pubsub message from Project B. So in the DataflowPipelineOption, I use options.setGcpCredential to set it to use that service account. But when the PubsubIO.readString() tries to read the message, it is still using the GCP credential when launching the dataflow job, not the one I set in the option.

I tried to dive into the code and found when creating PubsubJsonClient, the option doesn't have the gcpCredential field from the pipeline option. Can anyone help on this please? Thanks.

Issue Priority

Priority: 2 (default / most bugs should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@liferoad
Copy link
Collaborator

liferoad commented Sep 2, 2023

@dpcollins-google any clue?

@dpcollins-google
Copy link
Contributor

PubsubIO is replaced by dataflow internally and may not respect this. PubsubLiteIO likely just doesn't support this option.

@sriram23kmm
Copy link

@dpcollins-google was there any other options to read from other projects pubsub topic using service credentials..?

@dpcollins-google
Copy link
Contributor

Not a question for me, its a question for dataflow people since PubsubIO is replaced internally. @aaltay may know

@scwhittle
Copy link
Contributor

It does appear that PubsubJsonClient uses the credential here

However as Daniel notes the PubsubIO implementation is overridden for dataflow.
You can use --experiment=enable_custom_pubsub_source to disable the read PubsubIO replacement done with dataflow. However you will not benefit from the features: https://cloud.google.com/dataflow/docs/concepts/streaming-with-cloud-pubsub#integration-features

However couldn't you instead grant Service account A viewer/subscriber permissions to read from the topic/sub owned by account B?

@scwhittle
Copy link
Contributor

Please reopen above if granting permission to the service account used by Dataflow is not sufficient to fix the issue.

@github-actions github-actions bot added this to the 2.53.0 Release milestone Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants