Body of the handler:
const one: ValidatedEventAPIGatewayProxyEvent<typeof schema> = async (event) => {
const input = {
"EndTimestamp": new Date(1653843539000),
"Format": "JPEG",
"ImageSelectorType": "PRODUCER_TIMESTAMP",
"MaxResults": 10,
"SamplingInterval": 3000,
"StartTimestamp": new Date(1653843480000),
"StreamName": "ExampleStream"
}
console.log('input', JSON.stringify(input, null,2))
const client = new KinesisVideoArchivedMediaClient({ region: "eu-central-1" });
const command = new GetImagesCommand(input);
const res = await client.send(command);
console.log('res', JSON.stringify(res, null,2))
return formatJSONResponse({
message: 'success',
event,
});
}
Current result - log from the code:
2022-05-29T17:43:31.063Z 2d#################535 INFO res {
"$metadata": {
"httpStatusCode": 200,
"requestId": "38##################0e",
"attempts": 1,
"totalRetryDelay": 0
}
}
Expected: response including Images, NextToken properties
Other details:
Request with the same input executed from Postman gives a correct response:
{
"Images": [
{
"Error": "NO_MEDIA",
"ImageContent": null,
"TimeStamp": 1.65384348E9
},
{
"Error": null,
"ImageContent": "/9j/4AAQSkZJRgABAgAAAQABAAD//gARTGF2YzU4LjEzNC4xMDAA/...",
"TimeStamp": 1.653843486E9
}
],
"NextToken": "eyJleHB...n0ifQ=="
}
What I'm doing wrong? Thanks in advance
In case anyone else struggles with this, here is working V3 code. The bug is not in the code, it is in the documentation (according to AWS folks)