title: Aws step function timeout not catched by error handler
body: <p>I have the following state where the timeout is not catch nevertheless there is the catch with &quot;States.ALL&quot;. According to here <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html</a>
  it should be. Can you tell me what is wrong?</p>
  <pre><code>   &quot;PublishIotCmd&amp;WaitTask&quot;: {
        &quot;Next&quot;: &quot;SuccedTask&quot;,
        &quot;Retry&quot;: [
          {
        [..]
          }
        ],
        &quot;Catch&quot;: [
          {
            &quot;ErrorEquals&quot;: [
              &quot;States.ALL&quot;
            ],
            &quot;ResultPath&quot;: &quot;$.error&quot;,
            &quot;Next&quot;: &quot;ErrorHandlerTask&quot;
          }
        ],
        &quot;Type&quot;: &quot;Task&quot;,
        &quot;TimeoutSeconds&quot;: 600,
        &quot;ResultPath&quot;: &quot;$.cmdResult&quot;,
        &quot;Resource&quot;: &quot;arn:aws:states:::lambda:invoke.waitForTaskToken&quot;,
        &quot;Parameters&quot;: {
          &quot;FunctionName&quot;: &quot;xx&quot;,
          &quot;Payload&quot;: {
            &quot;token.$&quot;: &quot;$$.Task.Token&quot;,
            &quot;request.$&quot;: &quot;$.detail&quot;
          }
        }
      },
  </code></pre>
  <p>On the specific case the timeout is due to the task not getting the token with sendTaskSuccess. The error is, of course, this one but &quot;ErrorHandlerTask&quot; is not called, the state machine just hangs.</p>
  <pre><code>const publishIot = new tasks.LambdaInvoke(this, 'PublishIotCmd&amp;WaitTask', {
    lambdaFunction: iotSendCommandFn,
    payload: sfn.TaskInput.fromObject({
      token: sfn.JsonPath.taskToken,
      //request: sfn.JsonPath.entirePayload,
      request: sfn.JsonPath.stringAt('$.detail'),
    }),
    resultPath: '$.cmdResult',
    integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
    timeout: Duration.minutes(TIMEOUT_WAIT_REPLY_SECONDS),
  </code></pre>
  <p>Thank you in advance</p>