twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
278 stars 40 forks source link

V1VideoClient - Unable to UpdateRoomRecordingRule #149

Closed lsiv568 closed 2 years ago

lsiv568 commented 2 years ago

Issue Summary

When calling UpdateRoomRecordingRule on the client.v1Video the error Status: 400 - ApiError 53120: Invalid Recording Rule(s) (null) More info: https://www.twilio.com/docs/errors/53120 is always returned. However, I have confirmed (see screen shot below) that the proper data is being sent and the rules are in fact valid.

Screen Shot 2022-03-21 at 12 21 42 PM

Steps to Reproduce

  1. Create a v1video client
  2. Create an UpdateRoomRecordingRuleParams
  3. Invoke UpdateRoomRecordingRule on the client

Code Snippet

var (
    startRecordingRules = map[string]interface{}{
        "type": "include",
        "all":  true,
    }
)

func (ts *twilioSvc) StartRecording(roomName string) error {
    startRecordRulesReq := &openapi.UpdateRoomRecordingRuleParams{
        Rules: &startRecordingRules,
    }

    _, err := ts.videoClient.UpdateRoomRecordingRule(roomName, startRecordRulesReq)

    return err
}

Exception/Log

Status: 400 - ApiError 53120: Invalid Recording Rule(s) (null) More info: https://www.twilio.com/docs/errors/53120

Technical details:

childish-sambino commented 2 years ago

Looks like the API is expecting an array of objects and not just a singular object. After the fix, your rules would change to this:

    startRecordingRules = []map[string]interface{}{{
        "type": "include",
        "all":  true,
    }}

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.