Open marcoreni opened 1 year ago
This is a known limitation of sinks. As you pointed out, the data is transferred over postMessage
from a worker thread to the main Node.js thread which uses the structured clone algorithm.
https://nodejs.org/api/worker_threads.html#portpostmessagevalue-transferlist
Looks like our documentation doesn't call out this limitation clearly enough though. I think we should add this information on proxySinks
and the WorkerOptions.sinks
.
https://typescript.temporal.io/api/namespaces/workflow#sinkfunction
What are you really trying to do?
Sending an error to a Sink function and preserve all the attributes.
Describe the bug
It seems that the error that the error received from the sink function has less fields than the error which was sent.
For example: we're creating an ApplicationFailure.nonRetryable from a child workflow, and we're intercepting the error inside the parent workflow.
Error inside the parent workflow:
Error that is received from the sink:
Given that, IIUC, the sink is implemented via a postMessage, would it be possible to extend the serialization format of the error so that more fields are passed through (more specifically, we're currently interested in
type
anddetails
of the cause)?Minimal Reproduction
N/A
Environment/Versions
Additional context