Skip to content

Conversation

@abhishekjain16
Copy link

While running long workflows that require synchronous results, await_workflow_result throws the following exception:

await_workflow_result': undefined method 'type' for nil:NilClass (NoMethodError)

pointing to line https://github.com/coinbase/temporal-ruby/blob/master/lib/temporal/client.rb#L251

Reason:
When trying to fetch workflow execution history with event_type: :close, Temporal sends empty events payload after next event (not necessarily close event)
Calling .first.type fails on empty event.

Fix:
Follow what official SDK does in Go and TS. Create a loop and try and fetch close event till it can find one
TS Example:
https://github.com/temporalio/sdk-typescript/blob/913e67e6381c421c3ed02ee24518adfa1243c84c/packages/client/src/workflow-client.ts#L630

Go Example:
https://github.com/temporalio/sdk-go/blob/626785769094562b39662d6076304c807b596ed9/internal/internal_workflow_client.go#L433-L436

This PR tries to replicate the same behavior

@morgan121
Copy link

morgan121 commented Sep 22, 2024

@bdchauvette We are also getting this error now, is it possible to merge this fix? It's causing us a bit of headache

@abhishekjain16
Copy link
Author

abhishekjain16 commented Oct 24, 2024

@cj-cb @DeRauk Do you think we can merge this? I can fix conflict but only if there is a need to do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants