async function checkForPriorProcessing()

in source/lambda/extractaudio/extractaudio.js [187:221]


async function checkForPriorProcessing(params) {
  try {
    var queryParams = {
      TableName: params.dynamoVideoTable,
      IndexName: "s3VideoPathIndex",
      KeyConditionExpression: "s3VideoPath = :s3_video_path",
      ExpressionAttributeValues: {
        ":s3_video_path": { S: params.inputS3Path },
      },
    };

    console.log(
      "[INFO] checking DynamoDB for existing video using: %j",
      queryParams
    );
    var queryResponse = await dynamoDB.query(queryParams).promise();
    console.log(
      "[INFO] got successful response from GSI query: %j",
      queryResponse
    );

    if (queryResponse.Items && queryResponse.Items[0]) {
      params.videoId = queryResponse.Items[0].videoId.S;
      params.videoName = queryResponse.Items[0].name.S;
      params.language = queryResponse.Items[0].language.S;

      if (queryResponse.Items[0].description) {
        params.videoDescription = queryResponse.Items[0].description.S;
      }
    }
  } catch (error) {
    console.log("[ERROR] failed to check if video exists in DynamoDB", error);
    throw error;
  }
}