Skip to content

[Bug]: Issues with TypeScript types for video.startArchive #1298

Description

@pebergia

Node Version

22.x

Platform

Mac (Apple Silcon)

SDK Version

3.29.0

Code Sample

const startTimestamp = Date.now();
const composedTag = `composed-${startTimestamp}`;
const individualTag = `individual-${startTimestamp}`;
const trimmedArchiveName = archiveName?.trim();

const defaultOptions: Partial<ArchiveOptions> = {
  hasAudio,
  hasVideo,
  hasTranscription,
  transcriptionProperties: {
    hasSummary: true,
  },
};

const startedArchives: (SingleArchiveResponse & {
  multiArchiveTag?: string;
})[] = [];

try {
  const composedArchive = await vonage.video.startArchive(sessionId, {
    ...defaultOptions,
    outputMode: ArchiveOutputMode.COMPOSED,
    ...(trimmedArchiveName ? { name: `${trimmedArchiveName}-composed` } : {}),
    ...{ multiArchiveTag: composedTag },
  });
  startedArchives.push(composedArchive);

  const individualArchive = await vonage.video.startArchive(sessionId, {
    ...defaultOptions,
    outputMode: ArchiveOutputMode.INDIVIDUAL,
    ...(trimmedArchiveName
      ? { name: `${trimmedArchiveName}-individual` }
      : {}),
    ...{ multiArchiveTag: individualTag },
  });
  startedArchives.push(individualArchive);

  return sendJson(res, 200, {
    sessionId,
    startedAt: new Date(startTimestamp).toISOString(),
    archives: startedArchives.map((item) =>
      mapArchiveSummary(item, item.multiArchiveTag),
    ),
  });
} catch (error) {
  for (const startedArchive of startedArchives) {
    try {
      await vonage.video.stopArchive(startedArchive.id);
    } catch (stopError) {
      console.error(
        "Failed to rollback partially started archive:",
        stopError,
      );
    }
  }

  console.error("error starting archive: ", error);

  return sendJson(res, 500, {
    error: getErrorMessage(error, "Failed to start archives."),
  });
}

Expected Behavior

  • I would expect to easily use multiArchiveTag in typescript (without extending interface or casting types with any)
  • I want to use transcription related arguments as the types say exist

Actual Behavior

Quick summary:

  • Type error without casting when trying to use multiArchiveTag with vonage.startArchive
  • 400 bad request error when using hasTranscription or transcriptionProperties options when starting an archive.

Longer one:

I've recently been testing archiving videos and I was going through this bit of documentation:

https://developer.vonage.com/en/video/guides/archiving/overview#simultaneous-archive-recordings

I want to do a composed and individual on the same session and noticed multiArchiveTag isn't in the TypeScript interface for ArchiveOptions (nor the response for archive related APIs).

It would be nice to have this option within the types and to note its purpose.

I was also trying to use the transcription related arguments, but I kept getting 400 bad request errors when I tried any of those. I saw on the related doc page it isn't supported by the sdk, only the rest API, which is confusing cause the TypeScript types has those options (hasTranscription and transcriptionProperties). I have confirmed that without the transcription options, I can archive and view those files in my vonage account.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugA defect in the code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions