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

PERMISSION_DENIED when provisioning ProducerDestination in spring-cloud-gcp-pubsub-stream-binder #3249

Open
Manujsa opened this issue Sep 24, 2024 · 1 comment
Labels
priority: p2 type: bug Something isn't working

Comments

@Manujsa
Copy link

Manujsa commented Sep 24, 2024

Hi Team,
Putting this bug related to Producer Destination , Earlier you guys fixed similar kind of issue for Consumer Destination as part of this ticket #1348. On the similar note you also need to fix it for Producer Destination, it still exists for ProducerDestination in latest 5.6.0 version in PubSubChannelProvisioner._ It uselessly enter into ensureTopicExists method and search for this.pubSubAdmin.getTopic(topicName) while auto-create-resources=false that required additional pubsub.get.topics permission for SA .

Current Implementation:

@Override
public ProducerDestination provisionProducerDestination(
  String topic, ExtendedProducerProperties properties) {
  ensureTopicExists(topic, properties.getExtension().isAutoCreateResources());

  return new PubSubProducerDestination(topic);
}

Required Implementation:

@Override
public ProducerDestination provisionProducerDestination(
  String topic, ExtendedProducerProperties properties) {

  boolean autoCreate = properties.getExtension().isAutoCreateResources();

  // topicName may be either the short or fully-qualified version.
  String topicShortName =
    TopicName.isParsableFrom(topicName) ? TopicName.parse(topicName).getTopic() : topicName;
  if (autoCreate) {
    ensureTopicExists(topicShortName, autoCreate);
  }
  return new PubSubProducerDestination(topic);
}

Please fixed it and update us here !

@burkedavison burkedavison added type: bug Something isn't working priority: p2 labels Sep 26, 2024
@burkedavison
Copy link
Member

burkedavison commented Sep 26, 2024

Source reference:

@Override
public ProducerDestination provisionProducerDestination(
String topic, ExtendedProducerProperties<PubSubProducerProperties> properties) {
ensureTopicExists(topic, properties.getExtension().isAutoCreateResources());
return new PubSubProducerDestination(topic);
}

ensureTopicExists currently throws a ProvisionerException for topics that don't exist when auto-create-resources is false. A side-effect of this suggestion would be that this exception would no longer be thrown.

(I'm not currently advocating for or against this request.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants