'AWS Step function - choice step - TimestampEquals matching with multiple input variables

I have been trying to create a step function with a choice step that acts as a rule engine. I would like to compare a date variable (from the stale input JSON) to another date variable that I generate with a lambda function.

AWS documentation does not go into details about the Timestamp comparator functions, but I assumed that it can handle two input variables. Here is the relevant part of the code:

{
  "Variable": "$.staleInputVariable",
  "TimestampEquals": "$.generatedTimestampUsingLambda"
}

Here is the error that I am getting when trying to update(!!!) the stepFunction. I would like to highlight the fact that I don't even get to invoking the stepFunction as it fails while updating the function.

Resource handler returned message: "Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: String does not match RFC3339 timestamp at ..... (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition; Request ID: 97df9775-7d2d-4dd2-929b-470c8s741eaf; Proxy: null)" (RequestToken: 030aa97d-35a5-a6a5-0ac5-5698a8662bc2, HandlerErrorCode: InvalidRequest)

The stepfunction updates without the Timestamp matching, therefore, I suspect this bit of code.. Any guess?

EDIT (08.Jun.2021):

A comparison – Two fields that specify an input variable to compare, the type of comparison, and the value to compare the variable to. Choice Rules support comparison between two variables. Within a Choice Rule, the value of Variable can be compared with another value from the state input by appending Path to name of supported comparison operators. Source: AWS docs

It clearly states that two variables can be compared, but to no avail. Still trying :)



Solution 1:[1]

Looks like you indeed found a way around your initial challenge from the thread linked below.

Using an amazon step function, how do I write a choice operator that references current time?

However, I thought you wanted to compare $.staleInputVariable to the current timestamp and I wince to think you had to configure a lambda function (and test it!) to do only that.

If so, you could have achieved that simply by using the Context Object or $$.:

{
  "Variable": "$$.State.EnteredTime",
  "TimestampEqualsPath": "$.staleInputVariable"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman