AWS SDK ElasticTranscoder readJob 返回未定义

编程入门 行业动态 更新时间:2024-10-07 01:21:38

AWS SDK ElasticTranscoder readJob 返回<a href=https://www.elefans.com/category/jswz/34/1771258.html style=未定义"/>

AWS SDK ElasticTranscoder readJob 返回未定义

我正在使用适用于 Javascript 的 AWS 开发工具包,并且我有用于读取作业的代码:


const getJobOutputDuration=async()=>{
   // read jobInfo
   const jobDetailsResult = const result = await elasticTranscoder.readJob({ Id: jobId }).promise();
  // if not found, throw an error
  if (! jobDetailsResult.Job?.Id) {
      throw new Error("Job object not found!");
    }

  // read output duration from job
  const outputDuration = jobDetails.Job.Output?.Duration
  return outputDuration;
}

但有时,

outputDuration
返回
undefined
。代码流程是:

  1. 在 ElasticTranscoder 上触发作业
  2. Elastic Transcoder jobId
    保存在数据库中
  3. ElasticTranscoder 完成后,它会将输出文件保存在 S3 存储桶中
  4. S3 存储桶向 SNS 发送事件
  5. SNS 将事件发送到我代码中的端点
  6. 代码运行之前定义的函数getJobOutputDuration

Ps: 我注意到当我在几分钟后尝试运行相同的代码时,它确实正确地返回了输出持续时间

回答如下:

更多推荐

AWS SDK ElasticTranscoder readJob 返回未定义

本文发布于:2024-05-30 12:25:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1770495.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未定义   SDK   AWS   readJob   ElasticTranscoder

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!