localstack icon indicating copy to clipboard operation
localstack copied to clipboard

bug: Step Functions: State.EnteredTime format does not match AWS

Open attila opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

I just noticed that the State.EnteredTime in the context object has a differently formatted timestamp compared to what's in the AWS service or in stepfunctions-local.

This mismatch of formats can also be observed between Execution.StartTime and State.EnteredTime, where the former is correct.

I only noticed this because we use State.EnteredTime as an "updated_at" attribute in our DynamoDB records.

Using the example below, the parsed output we receive is:

{
  "Result": {
    "Execution_StartTime": "2024-04-24T06:27:25.830Z",
    "State_EnteredTime": "2024-04-24T06:27:25.839938+00:00"
  }
}

Note the granularity of the sub-second element, and the timezone offset notation.

Expected Behavior

The date formats should match for both context attributes:

{
  "Result": {
    "Execution_StartTime": "2024-04-24T06:27:25.830Z",
    "State_EnteredTime": "2024-04-24T06:27:25.840Z"
  }
}

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker compose up

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

Create state machine

awslocal stepfunctions create-state-machine \
  --name 'example' \
  --role-arn "arn:aws:iam::000000000000:role/stepfunctions-role" \
  --definition '{"StartAt":"Debug","States":{"Debug":{"Type":"Pass","Parameters":{"Execution_StartTime.$":"$$.Execution.StartTime","State_EnteredTime.$":"$$.State.EnteredTime"},"ResultPath":"$.Result","End":true}}}'

Start an execution

awslocal stepfunctions start-execution \
  --state-machine-arn "arn:aws:states:eu-west-1:000000000000:stateMachine:example" \
  --name 'test1'

Describe execution

awslocal stepfunctions describe-execution \
  --execution-arn "arn:aws:states:eu-west-1:000000000000:execution:example:test1"

Environment

- OS: MacOS
- LocalStack: nightly (2024-04-23)

Anything else?

For readability, this is the state machine definition used in the above example:

{
  "StartAt": "Debug",
  "States": {
    "Debug": {
      "Type": "Pass",
      "Parameters": {
        "Execution_StartTime.$": "$$.Execution.StartTime",
        "State_EnteredTime.$": "$$.State.EnteredTime"
      },
      "ResultPath": "$.Result",
      "End": true
    }
  }
}

attila avatar Apr 24 '24 06:04 attila

Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

localstack-bot avatar Sep 27 '24 08:09 localstack-bot

I believe this is still a valid bug and that it should be addressed.

attila avatar Oct 01 '24 08:10 attila

Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

localstack-bot avatar Feb 28 '25 10:02 localstack-bot