Effect CommunityEC
Effect Community5mo ago
6 replies
jrmdayn

Suggestions for Handling Long Workflow Names and Improving Error Messages

I have this workflow:
export const FetchDocsAndTriggerAssessmentsForAllPatients = Workflow.make({
  name: 'FetchDocsAndTriggerAssessmentsForAllPatients',
  ...
})


When I use the proxy client to execute that workflow (discard mode):
client.workflows.FetchDocsAndTriggerAssessmentsForAllPatientsDiscard(...)


I get this error on the client:
ResponseError: Decode error (500 POST http://0.0.0.0:3000/fetch-docs-and-trigger-assessments-for-all-patients/discard)

And just a log info on the runner:
[15:18:20.172] INFO (#195) http.span.1=17ms: Sent HTTP response
  http.status: 500
  http.method: POST
  http.url: /fetch-docs-and-trigger-assessments-for-all-patients

With nothing more to help me figure it out.

Switching to the non discard mode helped me narrow it down as I now see an error in the client and in the runner:
[cause]: PostgresError: value too long for type character varying(50)


Turns out my workflow name is too long: the resulting entity_type is Workflow/FetchDocsAndTriggerAssessmentsForAllPatients which is 54 characters long.. The column entity_type is a character varying(50).

I would like to make three suggestions:
1. would it be possible to increase the length of entity_type column? to 100 or 200 even? having descriptive workflow names is very important IMO and I would not want to shorten it and make it less clear because of a constraint like this one..
2. would it be possible to fail at runtime (early) when calling Workflow.make if the name is too long?
3. would it be possible to make the error less cryptic when using the Discard API?
Was this page helpful?