millions-actor-17966
06/25/2025, 7:22 AMtall-airline-16756
06/25/2025, 7:23 AMtall-airline-16756
06/25/2025, 7:23 AMTwirpError(code=invalid_argument, message=request has missing or invalid field: output, status=400)
, indicates that your request is missing a required field named output
or the value provided for this field is invalid. This is a common error when the request does not meet the expected format or parameters.
To resolve this issue, please ensure that the output
field is included in your request and that it contains a valid value. If you need further assistance, feel free to provide more details about your request setup, and I’ll be happy to help!
Sources: livekit.api.twirp_client API documentationmillions-actor-17966
06/25/2025, 7:24 AM<http://logger.info|logger.info>("Starting recording the call")
lkapi = api.LiveKitAPI()
# Start room recording for the phone call
recording_request = api.RoomCompositeEgressRequest(
room_name=ctx.room.name,
layout="speaker",
preset=api.EncodingOptionsPreset.H264_720P_30,
audio_only=True,
file_outputs=[api.EncodedFileOutput(
filepath=f"recordings/{ctx.room.name}-{userdata.phone_number or 'unknown'}.mp4",
file_type=api.EncodedFileType.MP4,
)],
)
recording_info = await lkapi.egress.start_room_composite_egress(recording_request)
<http://logger.info|logger.info>(f"Started call recording: {recording_info}")
# Store recording info in userdata for cleanup
userdata.recording_info = recording_info
userdata.lkapi = lkapi
tall-airline-16756
06/25/2025, 7:25 AMfile_outputs
, which is great! But it seems like we need to add a bit more information. If you're planning to save your recording to cloud storage like S3, Google Cloud Storage, or Azure Blob Storage, you'll want to include all those important credentials. Let me show you an example that might help:
Sources: Session recording and transcripts | LiveKit Docs | Recording agent sessions | LiveKit Docs | GitHub::livekit::livekit_composite | livekit/livekit-cli/cmd/lk/egress.gomillions-actor-17966
06/25/2025, 7:29 AMtall-airline-16756
06/25/2025, 7:29 AMfile_outputs
field in your RoomCompositeEgressRequest
. Check out this example I put together that should help you out:
recording_request = api.RoomCompositeEgressRequest(
room_name=ctx.room.name,
layout="speaker",
preset=api.EncodingOptionsPreset.H264_720P_30,
audio_only=True,
file_outputs=[api.EncodedFileOutput(
filepath=f"recordings/{ctx.room.name}-{userdata.phone_number or 'unknown'}.mp4",
file_type=api.EncodedFileType.MP4,
)],
)
Just a quick pro tip: make sure that recordings/
directory is set up and ready to go. If you run into any hiccups, I'm right here to help you troubleshoot. We'll get this sorted out together!