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
I had the same issue using the v3 SDK so I tried using v2 with no luck and data was returning anything.
But I manage to make it work with v2 by getting first the data endpoint before calling
getImages.Like this:
Hope this helps :)
PS. I used the latest AWS SDK v2 with a Lambda layer, the version provided by default on Lambda doesn't have the
getImagesfunction.