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

PubSub Consume task fails with NullPointerException when no subscription is provided #350

Open
shrutimantri opened this issue Mar 23, 2024 · 2 comments
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working good first issue Great issue for new contributors

Comments

@shrutimantri
Copy link
Contributor

Expected Behavior

When no subscription is provided, PubSub Consume task should automatically create a subscription as specified in the description of the subscription attribute.

Actual Behaviour

When no subscription is provided, PubSub Consume task fails with NullPointerException.

Here is the stacktrace:

2024-03-23 15:59:18.522 java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:903)
	at com.google.pubsub.v1.ProjectSubscriptionName.<init>(ProjectSubscriptionName.java:57)
	at com.google.pubsub.v1.ProjectSubscriptionName.<init>(ProjectSubscriptionName.java:29)
	at com.google.pubsub.v1.ProjectSubscriptionName$Builder.build(ProjectSubscriptionName.java:157)
	at com.google.pubsub.v1.ProjectSubscriptionName.of(ProjectSubscriptionName.java:61)
	at io.kestra.plugin.gcp.pubsub.AbstractPubSub.createSubscription(AbstractPubSub.java:45)
	at io.kestra.plugin.gcp.pubsub.Consume.run(Consume.java:84)
	at io.kestra.plugin.gcp.pubsub.Consume.run(Consume.java:29)
	at io.kestra.core.runners.Worker$WorkerThread.run(Worker.java:710)

Steps To Reproduce

  1. Take the example flow, and put in appropriate values.
  2. Do not add the subscription attribute to the task.
  3. Execute the task. The execution fails with NullPointerException.

I also tried by adding autoCreateSubscription: true, but still the same error.

Environment Information

  • Kestra Version: 0.15.5
  • Plugin version: 0.15.5
  • Operating System (OS / Docker / Kubernetes): Docker
  • Java Version (If not docker): N/A

Example flow

id: pubsub-consume
namespace: dev
tasks:
  - id: "consume"
    type: "io.kestra.plugin.gcp.pubsub.Consume"
    projectId: <project-id>
    serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_JSON') }}"
    topic: smantri-test
    maxRecords: 3
@shrutimantri shrutimantri added the bug Something isn't working label Mar 23, 2024
@anna-geller anna-geller added this to the v0.17.0 milestone Mar 25, 2024
@anna-geller anna-geller modified the milestones: v0.17.0, v0.20.0 Apr 17, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Jun 10, 2024
@anna-geller anna-geller removed this from the v0.20.0 milestone Aug 19, 2024
@anna-geller anna-geller added the area/plugin Plugin-related issue or feature request label Aug 19, 2024
@tchiotludo tchiotludo added good first issue Great issue for new contributors and removed kind/good-first-issue labels Oct 1, 2024
@benpops89
Copy link
Contributor

It would seem in the latest versions that subscription is now a required field (see below), so the above is not possible.

image

@loicmathieu
Copy link
Member

Yes, this has never been implemented so we switch the field to mandatory.
I think it's better to ask for a subscription to be configured than to create one each time the task is executed and delete it when task ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working good first issue Great issue for new contributors
Projects
Status: Backlog
Development

No branches or pull requests

5 participants