aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 13 forks source link

MediaLive DescribeThumbnails response has invalid RFC-3339 datetime #644

Closed blurfx closed 2 months ago

blurfx commented 11 months ago

Checkboxes for prior research

Describe the bug

When I send DescribeThumbnail command using node.js MediaLive client, smithy client throws Invalid RFC-3339 date-time value. see below reference where the error throws.

https://github.com/aws/aws-sdk-js-v3/blob/171254fbf7a9d9ea90d02b611962c8a5a2d2150c/packages/smithy-client/src/date-utils.ts#L108

the response from the MediaLive API was a pretty normal with HTTP 200, and the actual response was as follows. but TimeStamp wasn't follows RFC-3399, which seems to be causing the error.

{
    "ThumbnailDetails": [
        {
            "PipelineId": "0",
            "Thumbnails": [
                {
                    "Body": "…",
                    "ContentType": "image/jpeg",
                    "ThumbnailType": "CURRENT_ACTIVE",
                    "TimeStamp": "2023-07-18T12:04:24"
                }
            ]
        }
    ]
}

SDK version number

@aws-sdk/client-medialive@3.368.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v18.16.0

Reproduction Steps

import { MediaLiveClient } from "@aws-sdk/client-medialive";
const client = new MediaLiveClient({..});
const input: DescribeThumbnailsCommandInput = {
  ChannelId: "<your channel id>",
  PipelineId: "0",
  ThumbnailType: "CURRENT_ACTIVE",
};
const command = new DescribeThumbnailsCommand(input);
const response = await client.send(command);

Observed Behavior

TypeError Invalid RFC-3339 date-time value throws.

Stack traces:

TypeError: Invalid RFC-3339 date-time value
  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
  File "/usr/src/api-server/node_modules/.pnpm/@smithy+smithy-client@1.0.4/node_modules/@smithy/smithy-client/dist-cjs/date-utils.js", line 51, col 15, in parseRfc3339DateTimeWithOffset
    throw new TypeError("Invalid RFC-3339 date-time value");
  File "/usr/src/api-server/node_modules/.pnpm/@aws-sdk+client-medialive@3.368.0/node_modules/@aws-sdk/client-medialive/dist-cjs/protocols/Aws_restJson1.js", line 8720, col 116, in TimeStamp
    TimeStamp: [, (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)), `timeStamp`],
  File "/usr/src/api-server/node_modules/.pnpm/@smithy+smithy-client@1.0.4/node_modules/@smithy/smithy-client/dist-cjs/object-mapping.js", line 73, col 33, in applyInstruction
    target[targetKey] = valueFn(source[sourceKey]);
  File "/usr/src/api-server/node_modules/.pnpm/@smithy+smithy-client@1.0.4/node_modules/@smithy/smithy-client/dist-cjs/object-mapping.js", line 44, col 9, in take
    applyInstruction(out, source, instructions, key);
  File "/usr/src/api-server/node_modules/.pnpm/@aws-sdk+client-medialive@3.368.0/node_modules/@aws-sdk/client-medialive/dist-cjs/protocols/Aws_restJson1.js", line 8716, col 37, in de_Thumbnail
    return (0, smithy_client_1.take)(output, {
  File "/usr/src/api-server/node_modules/.pnpm/@aws-sdk+client-medialive@3.368.0/node_modules/@aws-sdk/client-medialive/dist-cjs/protocols/Aws_restJson1.js", line 6941, col 16, in <anonymous>
    return de_Thumbnail(entry, context);
  File "<anonymous>", in Array.map
  File "/usr/src/api-server/node_modules/.pnpm/@aws-sdk+client-medialive@3.368.0/node_modules/@aws-sdk/client-medialive/dist-cjs/protocols/Aws_restJson1.js", line 6940, col 10, in de___listOfThumbnail
    .map((entry) => {
  File "/usr/src/api-server/node_modules/.pnpm/@aws-sdk+client-medialive@3.368.0/node_modules/@aws-sdk/client-medialive/dist-cjs/protocols/Aws_restJson1.js", line 8731, col 31, in Thumbnails
    Thumbnails: [, (_) => de___listOfThumbnail(_, context), `thumbnails`],
  File "/usr/src/api-server/node_modules/.pnpm/@smithy+smithy-client@1.0.4/node_modules/@smithy/smithy-client/dist-cjs/object-mapping.js", line 73, col 33, in applyInstruction
    target[targetKey] = valueFn(source[sourceKey]);

Expected Behavior

It should return valid response of DescribeThumbnail API

Possible Solution

No response

Additional Information/Context

No response

RanVaknin commented 11 months ago

Hi @blurfx ,

Thanks for opening this issue. This issue is because the service models this field as a date-time data type which conforms to RFC3339. So in this case its missing the Z suffix.

-                    "TimeStamp": "2023-07-18T12:04:24"
+                    "TimeStamp": "2023-07-18T12:04:24Z"

I will need to reach out to the service team and ask that they return the data which they model.

Thanks, Ran~

vaughngit commented 10 months ago

Yes this is the message in SDK V2 which naturally prompt dev in v3 which currently doesnt work due to this issue: (node:29980) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

RanVaknin commented 10 months ago

rerouting this back to the JS team. This is clearly an issue with the upstream service, but other SDKs have customizations in place to make the timestamp format less restrictive (iso8601 rather than the stricter RFC3339)

RanVaknin commented 9 months ago

This is fixed service side. V1092938187

github-actions[bot] commented 9 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] commented 2 months ago

This issue is now closed.

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.