kestra-io / plugin-aws

https://kestra.io/plugins/plugin-aws/
Apache License 2.0
12 stars 7 forks source link

AWS SNS Publish task fails with an error #363

Open shrutimantri opened 5 months ago

shrutimantri commented 5 months ago

Expected Behavior

The example mentioned on this page should run successfully and publish a message to a SNS topic.

Actual Behaviour

The example mentioned on this page fails with the following error:

2024-01-28 20:09:28.954Cannot cast java.util.LinkedHashMap to io.kestra.plugin.aws.sns.model.Message
2024-01-28 20:09:28.954java.lang.ClassCastException: Cannot cast java.util.LinkedHashMap to io.kestra.plugin.aws.sns.model.Message
    at java.base/java.lang.Class.cast(Unknown Source)
    at io.reactivex.internal.functions.Functions$CastToClass.apply(Functions.java:222)
    at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:63)
    at io.reactivex.internal.operators.flowable.FlowableFromArray$ArraySubscription.fastPath(FlowableFromArray.java:132)
    at io.reactivex.internal.operators.flowable.FlowableFromArray$BaseArraySubscription.request(FlowableFromArray.java:88)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:153)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:153)
    at io.reactivex.internal.operators.flowable.FlowableReduceMaybe$ReduceSubscriber.onSubscribe(FlowableReduceMaybe.java:94)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:67)
    at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:67)
    at io.reactivex.internal.operators.flowable.FlowableFromArray.subscribeActual(FlowableFromArray.java:38)
    at io.reactivex.Flowable.subscribe(Flowable.java:14935)
    at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
    at io.reactivex.Flowable.subscribe(Flowable.java:14935)
    at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
    at io.reactivex.Flowable.subscribe(Flowable.java:14935)
    at io.reactivex.internal.operators.flowable.FlowableReduceMaybe.subscribeActual(FlowableReduceMaybe.java:57)
    at io.reactivex.Maybe.subscribe(Maybe.java:4290)
    at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
    at io.kestra.plugin.aws.sns.Publish.run(Publish.java:85)
    at io.kestra.plugin.aws.sns.Publish.run(Publish.java:26)
    at io.kestra.core.runners.Worker$WorkerThread.run(Worker.java:684)

Steps To Reproduce

  1. Create a flow with the task mentioned in the example on the SNS Publish task page
  2. Provide correct accessKeyId, secretKeyId, region and topicArn.
  3. Run the flow.

Environment Information

Example flow

id: "publish"
type: "io.kestra.plugin.aws.sns.Publish"
accessKeyId: "<access-key>"
secretKeyId: "<secret-key>"
region: "eu-central-1"
topicArn: "arn:aws:sns:eu-central-1:000000000000:MessageTopic"
from:
- data: Hello World
- data: Hello Kestra
  subject: Kestra

Also tried by enclosing the data and subject in double quotes. Still the same error.

joshuarestivo commented 2 months ago

Is this a matter of the published example being wrong or does the AWS plugin have issues? I see another identical issue open for SQS, for example. I've recreated this issue and it's the 'from' field that it's choking on.