Azure Video Indexer stalls when uploading MP4s with NodeJS API calls

I’m using NodeJS to upload a directory of mp4s one-by-one to Azure. For some reason, the video indexing stalls about 20% of the time. I’m not clear as to why. There are no errors displayed by the API call. When trying to load data for the video, I just get the status "Processing", but it never ends. I have to manually delete the video and start over.

Logging into the website, I can see that the process is stalled indefinitely:

video indexer stalling at 30% and 90%

Here is my NodeJS for uploading an MP4. I’d greatly appreciate any advice if I’m doing something wrong here:

const fs = require('fs');
const path = require('path');
const fetch = require('node-fetch');
const FormData = require('form-data');

const uploadVideo = async (filePath) => {
  const fileName = path.parse(filePath).name;

  const url = `${LOCATION}/Accounts/${ACCOUNTID}/Videos?accessToken=${TOKEN}&name=${fileName}&description=TEST&privacy=private&partition=some_partition`;

  const fileBase = path.parse(filePath).base; // e.g. "video1.mp4"
  const formData = new FormData();
  formData.append('file', fs.createReadStream(filePath), { filename: fileBase });

  const headers = {
    'x-ms-client-request-id': '',
    'Ocp-Apim-Subscription-Key': APIKEY,

  const response = await fetch(url, {
    cache: 'no-cache',
    method: 'POST',
    body: formData
  const json = await response.json();
  if (json.ErrorType && json.Message) {
    throw new Error(`${json.ErrorType} - ${json.Message}`);
  console.log('Successfully uploaded video');
uploadVideo('./video1.mp4').then((videoId) => console.log('result: ' + videoId)) // <- returns the correct videoId even when process stalls

3 thoughts on “Azure Video Indexer stalls when uploading MP4s with NodeJS API calls”

  1. Please add header 'Content-Type': 'multipart/form-data'.
    You can remove the ...formData.getHeaders()
    and please provide your account Id, and/or videoId that stalls so we can check internally

    Video Indexer Team


Leave a Comment