Skip to content

Bus: Step Function fails when there are uninitialized members and map/parallel states. #487

@thantos

Description

@thantos

$SFN.parallel, $SFN.map, and $SFN.retry (upcoming) will fail if any in scope member was never initialized.

let t;
try {
   t = $SFN.map(async () => {
      return func();
   });
} catch {
   t = [];
}

In order to make t available in parallel, we try to copy the value into the scope, but since the value doesn't exist, the state will fail.

Ideally, we should only copy in captured variables, not the entire scope.

This would just leave the edge case of a member that may or may not be initialized going into a scope that it may not be used in

let t;
if(x) {
   t = [];
}
try {
   t = $SFN.map(async () => {
      if(x) {
          return func(t);
      }
      return func();
   });
} catch {
   t = [];
}

When x is falsey, the machine will fail.

We could error when scope copying is non-deterministic.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions