-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(stepfunctions): item batcher doesn't properly render json paths
The ItemBatcher property of DistributedMap supports json path fields, but the new DistributedMap construct doesn't call FieldUtils.renderObject when rendering the ItemBatcher. Make sure to call `FieldUtils.renderObject()` when rendering this property. Added an integration test to ensure that the json path field resolves to the actual value from the state in the input by checking the output from the results writer in S3.
- Loading branch information
1 parent
665396f
commit 1b75865
Showing
15 changed files
with
35,318 additions
and
2 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...eg/test/aws-stepfunctions/test/integ-assets/get-succeeded-batch-execution-result/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* eslint-disable no-console */ | ||
|
||
import { | ||
S3Client, | ||
ListObjectsV2Command, | ||
GetObjectCommand, | ||
} from '@aws-sdk/client-s3'; | ||
|
||
const client = new S3Client({}); | ||
|
||
type ResultObject ={ | ||
ExecutionArn: string; | ||
Input: string; | ||
InputDetails: { Included: boolean }; | ||
Name: string; | ||
Output: string; | ||
OutputDetails: { Included: boolean }; | ||
RedriveCount: number; | ||
RedriveStatus: string; | ||
RedriveStatusReason: string; | ||
StartDate: string; | ||
StateMachineArn: string; | ||
Status: string; | ||
StopDate: string; | ||
}; | ||
|
||
export async function handler(event: { bucket: string; prefix: string }) { | ||
console.log('handling event', event); | ||
|
||
console.log('getting key for results writer succeeded file'); | ||
const listObjectsCommandOutput = await client.send(new ListObjectsV2Command({ | ||
Bucket: event.bucket, | ||
Prefix: event.prefix, | ||
})); | ||
|
||
if (!listObjectsCommandOutput.Contents) { | ||
throw new Error('No objects found'); | ||
} | ||
|
||
const succeedKey = listObjectsCommandOutput.Contents.find((object) => object?.Key?.endsWith('SUCCEEDED_0.json')); | ||
|
||
if (!succeedKey) { | ||
throw new Error('No SUCCEEDED_0.json found'); | ||
} | ||
console.log('found key', succeedKey.Key); | ||
|
||
console.log('getting object'); | ||
const object = await client.send(new GetObjectCommand({ | ||
Bucket: event.bucket, | ||
Key: succeedKey.Key, | ||
})); | ||
|
||
if (!object?.Body) { | ||
throw new Error('No object body found'); | ||
} | ||
|
||
const body: ResultObject[] = JSON.parse(await object.Body.transformToString()); | ||
console.log('got succeeded object body', body); | ||
|
||
return JSON.parse(body[0].Input); | ||
} |
32 changes: 32 additions & 0 deletions
32
...map-batch.js.snapshot/DistributedMapBatchInputDefaultTestDeployAssert0D5186B1.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.