stream-chat-js icon indicating copy to clipboard operation
stream-chat-js copied to clipboard

`getExportChannelStatus()` return value shows export is stuck with status `'waiting'`

Open mcevoypeter opened this issue 2 years ago • 0 comments

I'm attempting to export the contents of a channel using the following code:

const streamChat = StreamChat.getInstance(/*API key*/, /*API secret*/)
const channelType = 'team'

async function export(channelId: string) {
  const { task_id }: APIResponse & ExportChannelResponse = await streamChat.exportChannel(
      {
        id: channelId,
        type: channelType,
      },
      {
        version: 'v2',
      },
  )
  const task: APIResponse & ExportChannelStatusResponse = await streamChat.getExportChannelStatus(task_id)
  // Poll every 1000ms.
  await until(() => task.status !== 'waiting', 1000)
  console.log(task.result)
}

However, task.status is always 'waiting' and task.result never becomes non-null. Am I missing something obvious? What could cause an export task to get stuck in the 'waiting' state?

mcevoypeter avatar Aug 22 '23 15:08 mcevoypeter