finos / symphony-wdk

Symphony Workflow Developer Kit (WDK), a bot capable of running workflows
Apache License 2.0
3 stars 10 forks source link

Exception stack traces appear different in logs endpoint than backend #265

Closed ystxn closed 1 year ago

ystxn commented 1 year ago

Bug Report

255 introduced streaming exception stack traces to the streaming logs endpoint. This works well for internal errors, but somehow shows a slightly different stack trace for custom activities. Crucially, the core message from the original exception is lost, so a workflow developer won't be able to make sense of why the exception occurred.

Steps to Reproduce:

  1. Load WDK with Federation JAR
  2. Deliberately throw an exception with bad input (invalid advisor id etc)

Expected Result:

Identical stack trace appears in logs endpoint vs what appears in backend logs

Actual Result:

Backend Logs:

2023-05-18T03:33:43Z ERROR [camundaTaskExecutor-2] com.symphony.bdk.workflow.engine.camunda.CamundaExecutor: Activity from workflow hello:6:c7f4d1c1-f52c-11ed-b429-00155d9fdfdd failed proc.id=ca162b24-f52c-11ed-b429-00155d9fdfdd act.id=listRooms:ca1ae62a-f52c-11ed-b429-00155d9fdfdd 
org.springframework.web.client.HttpClientErrorException$NotFound: 404 : "{"type":"https://symphony.com/problems/advisor.not.found","title":"advisor not found","status":404,"traceId":"64659c9720243bf1ed7b2691d4bc7d8e","spanId":"ed7b2691d4bc7d8e"}"
    at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:113) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:168) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:825) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:783) ~[spring-web-5.3.26.jar!/:5.3.26]
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:676) ~[spring-web-5.3.26.jar!/:5.3.26]
    at com.symphony.devsol.federation.http.ApiClient.invokeAPI(ApiClient.java:596) ~[wdk-federation-client.jar:na]
    at com.symphony.devsol.federation.gen.RoomApi.listRoomsv2WithHttpInfo(RoomApi.java:641) ~[wdk-federation-client.jar:na]
    at com.symphony.devsol.federation.gen.RoomApi.listRoomsv2(RoomApi.java:587) ~[wdk-federation-client.jar:na]
    at com.symphony.devsol.federation.activity.ListConnectRoomsExecutor.execute(ListConnectRoomsExecutor.java:36) ~[wdk-federation-client.jar:na]
    at com.symphony.bdk.workflow.engine.camunda.CamundaExecutor.execute(CamundaExecutor.java:124) ~[classes!/:na]
    at org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:40) ~[camunda-engine-7.18.0.jar!/:7.18.0]
...

Logs endpoint:

2023-05-18T03:33:43.654Z [INFO] audit-trail - event=execute_activity, process=hello:6:c7f4d1c1-f52c-11ed-b429-00155d9fdfdd, process_key=hello, activity=listRooms, activity_name=listRooms, activity_type=ListConnectRooms
2023-05-18T03:33:43.930Z [ERROR] com.symphony.bdk.workflow.engine.camunda.CamundaExecutor - Activity from workflow hello:6:c7f4d1c1-f52c-11ed-b429-00155d9fdfdd failed
at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:113)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:168)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:825)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:783)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:676)
at com.symphony.devsol.federation.http.ApiClient.invokeAPI(ApiClient.java:596)
at com.symphony.devsol.federation.gen.RoomApi.listRoomsv2WithHttpInfo(RoomApi.java:641)
at com.symphony.devsol.federation.gen.RoomApi.listRoomsv2(RoomApi.java:587)
at com.symphony.devsol.federation.activity.ListConnectRoomsExecutor.execute(ListConnectRoomsExecutor.java:36)
at com.symphony.bdk.workflow.engine.camunda.CamundaExecutor.execute(CamundaExecutor.java:124)
at org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:40)

Environment:

WDK 1.6.0-SNAPSHOT

ystxn commented 1 year ago

Fixed by #266