Galil
Galil

Reputation: 869

AWS MediaLive - UnprocessableEntityException: Cannot read property 'destination' of undefined

I want to create a channel on AWS MediaLive using Go AWS SDK (tried with both v1 and v2).

But I am getting the following error:

UnprocessableEntityException: Cannot read property 'destination' of undefined status code: 422, request id: 5429aaff-fab9-11e7-843e-ed86ee7cfb22

The CreateChannel command looks like (this is for SDK v1):

req, err := svc.CreateChannel(&medialive.CreateChannelInput{
    Destinations: []*medialive.OutputDestination{
        &medialive.OutputDestination{
            Id: &destinationID,
            Settings: []*medialive.OutputDestinationSettings{
                {
                    PasswordParam: &param1,
                    Url:           destinationA.HlsIngest.IngestEndpoints[0].Url,
                    Username:      destinationA.HlsIngest.IngestEndpoints[0].Username},
                {
                    PasswordParam: &param2,
                    Url:           destinationB.HlsIngest.IngestEndpoints[0].Url,
                    Username:      destinationB.HlsIngest.IngestEndpoints[0].Username,
                },
            },
        },
    },
    EncoderSettings: &medialive.EncoderSettings{
        OutputGroups: []*medialive.OutputGroup{&medialive.OutputGroup{
            OutputGroupSettings: &medialive.OutputGroupSettings{
                HlsGroupSettings: &medialive.HlsGroupSettings{
                    HlsCdnSettings: &medialive.HlsCdnSettings{
                        HlsWebdavSettings: &medialive.HlsWebdavSettings{},
                    },
                },
            },
            Outputs: []*medialive.Output{&medialive.Output{}},
        }},
        VideoDescriptions: []*medialive.VideoDescription{&medialive.VideoDescription{
            Height: &videoHeight,
            Width:  &videoWidth,
            CodecSettings: &medialive.VideoCodecSettings{
                H264Settings: &medialive.H264Settings{
                    FramerateDenominator: &framerate,
                },
            },
        }},
    },
    InputAttachments: []*medialive.InputAttachment{&medialive.InputAttachment{InputId: input.Input.Id}},
    Name:             &channelName,
    RoleArn:          &arn,
})

Obviously the code contains many variables that have been initialised/created earlier as the CreateChannel action requires inputs, input security groups etc.

Nowhere in my code there is a property destination. There is only the field Destinations under CreateChannelInput.

If someone can give a hint about this error, it will be appreciated.

Upvotes: 1

Views: 531

Answers (1)

Galil
Galil

Reputation: 869

Finally what I did was to create a channel from the AWS console and then export its configuration to a JSON file using:

aws medialive describe-channel --channel-id <my_channel_id>

Every time I want to create a new channel using the SDK, I am loading the configuration from the JSON file and change some parameters, if necessary.

Upvotes: 2

Related Questions