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

SlackIncomingWebhook task with misconfigured payload crashed my kestra container #183

Open
anna-geller opened this issue Nov 26, 2024 · 3 comments
Assignees
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working

Comments

@anna-geller
Copy link
Member

Describe the issue

Reproducer:

id: error_logs_demo
namespace: company.team

tasks:    
  - id: fail
    type: io.kestra.plugin.core.execution.Fail
    errorMessage: Something went wrong

errors:
  - id: alert
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: https://reqres.in/api/slack
    payload: "Failure alert: {{ errorLogs() }}"
Logs 2024-11-26 02:02:03,811 INFO worker_38 flow.error_logs_demo.fail [namespace: company.team] [flow: error_logs_demo] [task: fail] [execution: 3nrh5qwQBythe1eAwaqrFA] [taskrun: 1mrptqL9E6ZrICgbPCrdda] Type Fail started 2024-11-26 02:02:03,835 ERROR worker_38 f.e.3.1mrptqL9E6ZrICgbPCrdda Something went wrong java.lang.Exception: Something went wrong at io.kestra.plugin.core.execution.Fail.run(Fail.java:115) at io.kestra.plugin.core.execution.Fail.run(Fail.java:19) at io.kestra.core.runners.WorkerTaskCallable.doCall(WorkerTaskCallable.java:78) at io.kestra.core.runners.AbstractWorkerCallable.call(AbstractWorkerCallable.java:56) at io.kestra.core.runners.WorkerSecurityService.callInSecurityContext(WorkerSecurityService.java:10) at io.kestra.core.runners.Worker.callJob(Worker.java:769) at io.kestra.core.runners.Worker.runAttempt(Worker.java:728) at io.kestra.core.runners.Worker.run(Worker.java:579) at io.kestra.core.runners.Worker.handleTask(Worker.java:284) at io.kestra.core.runners.Worker.lambda$run$7(Worker.java:240) at io.micrometer.core.instrument.internal.TimedRunnable.run(TimedRunnable.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) 2024-11-26 02:02:03,840 INFO worker_38 flow.error_logs_demo.fail [namespace: company.team] [flow: error_logs_demo] [task: fail] [execution: 3nrh5qwQBythe1eAwaqrFA] [taskrun: 1mrptqL9E6ZrICgbPCrdda] Type Fail with state RUNNING completed in 00:00:00.253 2024-11-26 02:02:04,639 INFO worker_39 flow.error_logs_demo.alert [namespace: company.team] [flow: error_logs_demo] [task: alert] [execution: 3nrh5qwQBythe1eAwaqrFA] [taskrun: 7v7PGRfrrgzhXn9fjv87G] Type SlackIncomingWebhook started 2024-11-26 02:02:05,180 ERROR worker_39 f.e.3.7v7PGRfrrgzhXn9fjv87G <title>Error</title>
Bad Request

io.micronaut.http.client.exceptions.HttpClientResponseException:

<title>Error</title>
Bad Request
at io.micronaut.http.client.netty.DefaultHttpClient.makeErrorFromRequestBody(DefaultHttpClient.java:2086)
at io.micronaut.http.client.netty.DefaultHttpClient.handleExchangeResponse(DefaultHttpClient.java:929)
at io.micronaut.http.client.netty.DefaultHttpClient.lambda$exchange$8(DefaultHttpClient.java:882)
at io.micronaut.core.execution.ImperativeExecutionFlowImpl.flatMap(ImperativeExecutionFlowImpl.java:72)
at io.micronaut.http.client.netty.DefaultHttpClient.lambda$exchange$9(DefaultHttpClient.java:882)
at io.micronaut.http.client.netty.DefaultHttpClient.lambda$sendRequestWithRedirectsNoFilter$46(DefaultHttpClient.java:1625)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondComplete(MonoFlatMap.java:245)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:305)
at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.onNext(MonoSubscribeOn.java:146)
at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:176)
at io.micronaut.http.client.netty.DefaultHttpClient$6.complete(DefaultHttpClient.java:1709)
at io.micronaut.http.client.netty.Http1ResponseHandler$BufferedContent.complete(Http1ResponseHandler.java:218)
at io.micronaut.http.client.netty.Http1ResponseHandler$BufferedContent.read(Http1ResponseHandler.java:181)
at io.micronaut.http.client.netty.Http1ResponseHandler$BufferedContent.read(Http1ResponseHandler.java:153)
at io.micronaut.http.client.netty.Http1ResponseHandler.channelReadInstrumented(Http1ResponseHandler.java:73)
at io.micronaut.http.client.netty.Http1ResponseHandler.channelReadInstrumented(Http1ResponseHandler.java:48)
at io.micronaut.http.client.netty.SimpleChannelInboundHandlerInstrumented.channelRead0(SimpleChannelInboundHandlerInstrumented.java:46)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:120)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
at io.netty.handler.codec.http2.AbstractHttp2StreamChannel$Http2ChannelUnsafe.doRead0(AbstractHttp2StreamChannel.java:981)
at io.netty.handler.codec.http2.AbstractHttp2StreamChannel.fireChildRead(AbstractHttp2StreamChannel.java:601)
at io.netty.handler.codec.http2.Http2MultiplexHandler.channelRead(Http2MultiplexHandler.java:193)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.http2.Http2FrameCodec.onHttp2Frame(Http2FrameCodec.java:717)
at io.netty.handler.codec.http2.Http2FrameCodec$FrameListener.onDataRead(Http2FrameCodec.java:656)
at io.netty.handler.codec.http2.Http2FrameListenerDecorator.onDataRead(Http2FrameListenerDecorator.java:34)
at io.netty.handler.codec.http2.Http2EmptyDataFrameListener.onDataRead(Http2EmptyDataFrameListener.java:49)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:320)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:409)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:244)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:164)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:186)
at io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:61)
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:391)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:451)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1503)
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1366)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1415)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Unknown Source)
Suppressed: java.lang.Exception: #block terminated with an error
	at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104)
	at reactor.core.publisher.Mono.block(Mono.java:1779)
	at io.micronaut.http.client.netty.DefaultHttpClient$1.exchange(DefaultHttpClient.java:615)
	at io.micronaut.http.client.netty.DefaultHttpClient$1.retrieve(DefaultHttpClient.java:623)
	at io.micronaut.http.client.BlockingHttpClient.retrieve(BlockingHttpClient.java:122)
	at io.micronaut.http.client.BlockingHttpClient.retrieve(BlockingHttpClient.java:171)
	at io.micronaut.http.client.BlockingHttpClient.retrieve(BlockingHttpClient.java:184)
	at io.kestra.plugin.notifications.slack.SlackIncomingWebhook.run(SlackIncomingWebhook.java:168)
	at io.kestra.plugin.notifications.slack.SlackIncomingWebhook.run(SlackIncomingWebhook.java:22)
	at io.kestra.core.runners.WorkerTaskCallable.doCall(WorkerTaskCallable.java:78)
	at io.kestra.core.runners.AbstractWorkerCallable.call(AbstractWorkerCallable.java:56)
	at io.kestra.core.runners.WorkerSecurityService.callInSecurityContext(WorkerSecurityService.java:10)
	at io.kestra.core.runners.Worker.callJob(Worker.java:769)
	at io.kestra.core.runners.Worker.runAttempt(Worker.java:728)
	at io.kestra.core.runners.Worker.run(Worker.java:579)
	at io.kestra.core.runners.Worker.handleTask(Worker.java:284)
	at io.kestra.core.runners.Worker.lambda$run$7(Worker.java:240)
	at io.micrometer.core.instrument.internal.TimedRunnable.run(TimedRunnable.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	... 1 common frames omitted

2024-11-26 02:02:05,182 INFO worker_39 flow.error_logs_demo.alert [namespace: company.team] [flow: error_logs_demo] [task: alert] [execution: 3nrh5qwQBythe1eAwaqrFA] [taskrun: 7v7PGRfrrgzhXn9fjv87G] Type SlackIncomingWebhook with state RUNNING completed in 00:00:00.015
2024-11-26 02:02:05,232 INFO jdbc-queue-Execution_0 flow.error_logs_demo [namespace: company.team] [flow: error_logs_demo] [execution: 3nrh5qwQBythe1eAwaqrFA] Flow completed with state FAILED in 00:00:01.832
2024-11-26 02:02:05,241 ERROR jdbc-queue-Execution_0 .c.u.ThreadUncaughtExceptionHandlers Caught an exception in Thread[#78,jdbc-queue-Execution_0,5,main]. Shutting down.
org.jooq.exception.IntegrityConstraintViolationException: SQL [insert into multipleconditions ("key", "value") values (?, ?)]; NULL not allowed for column "condition_id"; SQL statement:
insert into multipleconditions ("key", "value") values (?, ?) [23502-232]
at org.jooq_3.19.14.H2.debug(Unknown Source)
at org.jooq.impl.Tools.translate(Tools.java:3638)
at org.jooq.impl.Tools.translate(Tools.java:3628)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:827)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:362)
at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:115)
at io.kestra.repository.h2.H2Repository.persistInternal(H2Repository.java:62)
at io.kestra.repository.h2.H2Repository.persist(H2Repository.java:47)
at io.kestra.jdbc.runner.AbstractJdbcMultipleConditionStorage.lambda$save$2(AbstractJdbcMultipleConditionStorage.java:75)
at java.base/java.util.ArrayList.forEach(Unknown Source)
at io.kestra.jdbc.runner.AbstractJdbcMultipleConditionStorage.lambda$save$3(AbstractJdbcMultipleConditionStorage.java:73)
at org.jooq.impl.DefaultDSLContext.lambda$transaction$5(DefaultDSLContext.java:592)
at org.jooq.impl.DefaultDSLContext.lambda$transactionResult0$3(DefaultDSLContext.java:530)
at org.jooq.impl.Tools$3$1.block(Tools.java:6369)
at java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.managedBlock(Unknown Source)
at org.jooq.impl.Tools$3.get(Tools.java:6366)
at org.jooq.impl.DefaultDSLContext.transactionResult0(DefaultDSLContext.java:578)
at org.jooq.impl.DefaultDSLContext.transactionResult(DefaultDSLContext.java:502)
at org.jooq.impl.DefaultDSLContext.transaction(DefaultDSLContext.java:591)
at io.kestra.jdbc.JooqDSLContextWrapper.lambda$transaction$1(JooqDSLContextWrapper.java:58)
at dev.failsafe.Functions.lambda$toCtxSupplier$11(Functions.java:243)
at dev.failsafe.Functions.lambda$get$0(Functions.java:46)
at dev.failsafe.internal.RetryPolicyExecutor.lambda$apply$0(RetryPolicyExecutor.java:74)
at dev.failsafe.internal.FallbackExecutor.lambda$apply$0(FallbackExecutor.java:51)
at dev.failsafe.SyncExecutionImpl.executeSync(SyncExecutionImpl.java:187)
at dev.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:376)
at dev.failsafe.FailsafeExecutor.get(FailsafeExecutor.java:112)
at io.kestra.core.utils.RetryUtils$Instance.wrap(RetryUtils.java:144)
at io.kestra.core.utils.RetryUtils$Instance.runRetryIf(RetryUtils.java:103)
at io.kestra.jdbc.JooqDSLContextWrapper.transaction(JooqDSLContextWrapper.java:55)
at io.kestra.jdbc.runner.AbstractJdbcMultipleConditionStorage.save(AbstractJdbcMultipleConditionStorage.java:69)
at io.kestra.core.services.FlowTriggerService.computeExecutionsFromFlowTriggers(FlowTriggerService.java:110)
at io.kestra.jdbc.runner.JdbcExecutor.toExecution(JdbcExecutor.java:903)
at io.kestra.jdbc.runner.JdbcExecutor.toExecution(JdbcExecutor.java:864)
at io.kestra.jdbc.runner.JdbcExecutor.executionQueue(JdbcExecutor.java:570)
at java.base/java.util.ArrayList.forEach(Unknown Source)
at io.kestra.jdbc.runner.JdbcQueue.lambda$receive$7(JdbcQueue.java:264)
at io.kestra.jdbc.runner.JdbcQueue.lambda$receiveImpl$11(JdbcQueue.java:333)
at io.kestra.jdbc.runner.JdbcQueue.lambda$poll$12(JdbcQueue.java:356)
at io.micrometer.core.instrument.internal.TimedRunnable.run(TimedRunnable.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "condition_id"; SQL statement:
insert into multipleconditions ("key", "value") values (?, ?) [23502-232]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:520)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.get(DbException.java:199)
at org.h2.table.Column.validateConvertUpdateSequence(Column.java:402)
at org.h2.table.Table.convertInsertRow(Table.java:972)
at org.h2.command.dml.Insert.insertRows(Insert.java:167)
at org.h2.command.dml.Insert.update(Insert.java:135)
at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:74)
at org.h2.command.CommandContainer.update(CommandContainer.java:139)
at org.h2.command.Command.executeUpdate(Command.java:304)
at org.h2.command.Command.executeUpdate(Command.java:248)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:262)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:219)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:458)
at org.jooq.impl.AbstractDMLQuery.execute(AbstractDMLQuery.java:1068)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:348)
... 39 common frames omitted
2024-11-26 02:02:05,250 INFO default-nioEventLoopGroup-1-9 io.kestra.webserver.access 2024-11-26T02:02:03.462Z | GET /api/v1/executions/3nrh5qwQBythe1eAwaqrFA/follow HTTP/1.1 | status: 200 | ip: 172.17.0.1 | length: 928 | duration: 1787
2024-11-26 02:02:06,288 INFO jdbc-queue-Execution_0 io.kestra.core.runners.Worker All working threads are terminated.
2024-11-26 02:02:06,292 WARN jdbc-queue-Execution_0 i.k.c.server.ServiceLivenessManager Failed to transition service [id=5DCCZb8IF87z7AN0xXQ7M6, type=INDEXER, hostname=1dbfe40e9dd7] from TERMINATED_GRACEFULLY to TERMINATING. Cause: Invalid transition.
2024-11-26 02:02:06,293 ERROR jdbc-queue-Execution_0 i.k.c.server.ServiceLivenessManager [Service id=5DCCZb8IF87z7AN0xXQ7M6, type=INDEXER, hostname=1dbfe40e9dd7] Termination already completed (TERMINATED_GRACEFULLY). This error may occur if the service has already been evicted by Kestra due to a prior error.
2024-11-26 02:02:06,331 WARN command-shutdown io.kestra.cli.AbstractCommand Receiving shutdown ! Try to graceful exit
2024-11-26 02:02:06,331 WARN command-shutdown io.kestra.cli.AbstractCommand Receiving shutdown ! Try to graceful exit
2024-11-26 02:02:06,331 INFO command-shutdown i.kestra.core.contexts.KestraContext Kestra server - Shutdown initiated
2024-11-26 02:02:06,332 INFO command-shutdown i.kestra.core.contexts.KestraContext Kestra server - Shutdown completed
➜ ~

Environment

  • Kestra Version: develop
@anna-geller anna-geller added bug Something isn't working area/plugin Plugin-related issue or feature request labels Nov 26, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Nov 26, 2024
@mgabelle
Copy link
Contributor

mgabelle commented Nov 26, 2024

Hello @anna-geller,
When looking at this I am noticing that you use payload as plain text but it should be a JSON object like in the flow example :

id: error_logs_demo
namespace: mgabelle.tests.notifications.slack

tasks:    
  - id: fail
    type: io.kestra.plugin.core.execution.Fail
    errorMessage: Something went wrong

errors:
  - id: alert
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: https://reqres.in/api/slack
    payload: | 
      {
        "text": "Failure alert for flow {{ flow.namespace }}.{{ flow.id }} with ID {{ execution.id }}"
      }

But I am noticing that with the function errorLogs() it doesn't work. I assume it's related to the content returned by this function that is not correctly supported in a JSON string.
When using debug I have this content :

[{"namespace":"mgabelle.tests.notifications.slack","flowId":"error_logs_demo","taskId":"fail","executionId":"7DnHASsoscH2UEuG2Vd1C0","taskRunId":"61tMzA6sG3uISrFySCyUdc","attemptNumber":0,"timestamp":"2024-11-26T15:41:56.904Z","level":"ERROR","thread":"worker_17","message":"Something went wrong","deleted":false}] 

There's maybe a way to extract the content like with this flow for example :

id: error_logs_demo
namespace: mgabelle.tests.notifications.slack

tasks:    
  - id: fail
    type: io.kestra.plugin.core.execution.Fail
    errorMessage: Something went wrong

errors:
  - id: debug
    type: io.kestra.plugin.core.debug.Return
    format: "{{ errorLogs()[0] }}"


  - id: alert
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: https://reqres.in/api/slack
    payload: | 
      {
        "text": "Failure alert for flow {{ errorLogs()[0] }}"
      }

@mgabelle
Copy link
Contributor

Here's an other flow example when we loop through the errors and create a new section in the slack message for each error.

Notes:

  1. In this flow we have to add an empty section to prevent JSON error with the comma in the loop.
  2. Sometimes this flow doesn't work because there's no errors return by errorLogs()
id: error_logs_demo
namespace: mgabelle.tests.notifications.slack

tasks:    
  - id: fail
    type: io.kestra.plugin.core.execution.Fail
    errorMessage: Something went wrong

errors:
  - id: debug
    type: io.kestra.plugin.core.debug.Return
    format: "{{ errorLogs()[0] }}"


  - id: alert
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: https://reqres.in/api/slack
    payload: | 
      {
        "text": "Issue in flow {{ flow.id }}.",
        "blocks": [
          {% for error in errorLogs() %}
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": "Issue in flow : {{ error }}"
            }
          },
          {% endfor %}
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": ""
            }
          }
        ]
      }

@anna-geller
Copy link
Member Author

yup you're totally right here — the main part why I put it in 0.20 is the fact that this error crashed my kestra container. Seems destructive - maybe there's a way to "JSONify" the payload automatically by the plugin regardless of what the user provided? or add some other guardrail to ensure that whatever user entered under the payload won't crash the instance?

for now moved to 0.21 as I'm aware you have a lot of work remaining with dynamic properties

@Ben8t Ben8t self-assigned this Dec 3, 2024
@Ben8t Ben8t assigned mgabelle and unassigned Ben8t Dec 12, 2024
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
Projects
Status: Backlog
Development

No branches or pull requests

3 participants