aws / aws-sdk

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

CreateProgram: OffsetMillis cannot be missing #685

Closed mehulgohil-tal closed 2 months ago

mehulgohil-tal commented 5 months ago

Describe the bug

I am creating a Program in Mediatailor Channel. Using CreateProgram method. I am trying to add an Ad break at start of the program. Basically Offset 0. But the SDK is returning error stating operation error MediaTailor: CreateProgram, https response error StatusCode: 400, RequestID: 4b6d0fc7-c074-418f-bf2d-75ab598cfd78, api error BadRequestException: OffsetMillis cannot be missing..

While offset 0 works fine when inserted from AWS Console

Expected Behavior

The Program Should be created in channel with AD Break inserted at offset 0

Current Behavior

Giving Error operation error MediaTailor: CreateProgram, https response error StatusCode: 400, RequestID: 4b6d0fc7-c074-418f-bf2d-75ab598cfd78, api error BadRequestException: OffsetMillis cannot be missing.

Reproduction Steps

mediaTailorClient.CreateProgram(context.TODO(), &mediatailor.CreateProgramInput{
        ChannelName:        aws.String("TestChannel"),
        ProgramName:        aws.String("TestProgram1"),
        SourceLocationName: aws.String("TestSource"),
        VodSourceName:      aws.String("TestVOD"),
        ScheduleConfiguration: &types.ScheduleConfiguration{
            Transition: &types.Transition{
                Type:                     aws.String("RELATIVE"),
                RelativePosition:         "AFTER_PROGRAM",
                RelativeProgram:          aws.String("TestProgram"),
                ScheduledStartTimeMillis: aws.Int64(0),
            },
        },
        AdBreaks: []types.AdBreak{
            {
                MessageType:  "SPLICE_INSERT",
                OffsetMillis: 0,
                Slate: &types.SlateSource{
                    SourceLocationName: aws.String("sSLATE"),
                    VodSourceName:      aws.String("slate-3"),
                },
            },
        },
    })

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

v1.33.1

Compiler and Version used

go1.21.4

Operating System and version

Windows 11

RanVaknin commented 5 months ago

Hi @mehulgohil-tal ,

Thanks for reaching out.

This smells like other media-* services where INTs and LONGs are modeled without the required trait. OffsetMillis which is the member in question, is referred to twice in the model: once with the required trait and once without the required trait

Since the SDK is code generated from the model, and that lack of trait means that the SDK does not explicitly serialize 0 values, this is an issue that needs to be solved upstream with the media tailor service itself.

I will discuss this with the team, verify and then create an internal ticket with the service team.

To unblock you, you will need to create a middleware that will manually write that 0 value to the request to circumvent the serialization logic. You can find an example here.

Let us know if you need any help with the workaround. Thanks again, Ran~

mehulgohil-tal commented 5 months ago

Thanks @RanVaknin for the quick reply. I have applied my custom middleware similar to what you have shown, and working as expected.

Is this issue going to be resolved going forward ? or I have to continue with this workaround ?

lucix-aws commented 5 months ago

This is a discrepancy between the service's API model and its actual behavior, much like the various cases of aws/aws-sdk-go-v2#2162.

We will need to upstream this issue with the appropriate service team to pursue a fix.

RanVaknin commented 5 months ago

We have created a ticket with the MediaTailor service team P115786494. Moving to cross SDK repo for tracking.

Ran~

RanVaknin commented 2 months ago

This should be solved now. Can you please update the SDK and see if this solves your issue?

Thanks, Ran~

github-actions[bot] commented 2 months ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.