Files
floci/docs
TATSUNO “Taz” Yasuhiro 5db516d9d5 feat(sfn): Map ItemReader with s3:listObjectsV2 (#3460)
* feat(sfn): support the s3:listObjectsV2 Distributed Map ItemReader

The Map state listed the resource as accepted at CreateStateMachine
but failed every execution with States.ItemReaderFailed. It now calls
the S3 service in process, reads every page under Prefix, and gives
each child the AWS item shape: Etag, Key, LastModified, Size and
StorageClass. Bucket and Prefix come from Parameters or JSONata
Arguments. An empty prefix succeeds with zero iterations and
ReaderConfig.MaxItems trims the list.

LastModified is epoch seconds. Real AWS renders it as a double in
JSONPath state machines and as an integer in JSONata ones, and the
emulator does the same.

Fixes #3409

* fix(sfn): evaluate ItemSelector in JSONata Map states

A JSONata Map state passed ItemSelector through the JSONPath resolver,
so every {% %} expression reached the child as a literal string. The
Map state now resolves ItemSelector as a JSONata template with
$states.input bound to the Map input and $states.context.Map.Item
carrying Value and Index, as on AWS.

Real AWS evaluates ItemSelector before it records MapIterationStarted.
A failing expression therefore fails the Map state without any event
for that iteration, in both query languages. The evaluation moved
ahead of the iteration event to match.

Verified against real Step Functions in us-east-1 on 2026-09-12.

* chore(sfn): simplify the listObjectsV2 reader and the ItemSelector failure path

The reader listed the bucket page by page although the S3 service
returns the whole sorted listing in one call. The Map state kept two
copies of the iteration failure handling. The tests reuse the shared
mapper and one JSONata Map definition.

* perf(sfn): cap the listObjectsV2 listing at MaxItems

ReaderConfig.MaxItems keeps the first keys in key order on AWS, which
is what the S3 service returns for maxKeys. The reader now passes
MaxItems to the listing instead of building every item and trimming
afterwards.

* chore(sfn): declare local types in the listObjectsV2 reader

Replace var with explicit types in the production code this branch added.

* chore(sfn): declare local types in the listObjectsV2 reader tests

Replace var with explicit types in the test code this branch added.

* fix(sfn): list every object when MaxItems is absent

S3Service now treats max keys 0 as a request for an empty page, as AWS
does for max-keys=0. The listObjectsV2 reader passed 0 when
ReaderConfig.MaxItems was not set, so the Map got no items. It now asks
for Integer.MAX_VALUE in that case, like the DynamoDB import path.
2026-09-15 21:48:54 -04:00
..
2026-03-15 17:43:56 -05:00