Closed josephjclark closed 1 year ago
This issue is only occurring on workflows, but I think there's a wider story here.
The runtime right now will return whatever state was output from the last job. This could contain circular references, functions, and other non-serializable stuff.
The CLI can handle this "unclean" output because it runs fast-safe-stringify
on the output. So it gets non-serialzable output from the runtime, and deals with it itself.
Really, each expression we execute should return a safely serializable object. Functions removed (maybe stubbed in with [function]. Circular references replaced. So the runtime guarantees a safe result.
Basically fast-safe-stringify needs to move down to the runtime.
This is now fixed on the workflow branch: the runtime will always return serializable state, making everyone's life easier.
Using the salesforce adaptor in a workflow, we see:
The salesforce adaptor is writing some http request stuff to state. We then try and clone that, before passing it into the next job, which fails.
I think we need to use fast-safe-stringify instead of JSON.stringify to clone state
This job using http lets us reproduce: