未定义"/>
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
。代码流程是:
- 在 ElasticTranscoder 上触发作业
- 将
保存在数据库中Elastic Transcoder jobId
- ElasticTranscoder 完成后,它会将输出文件保存在 S3 存储桶中
- S3 存储桶向 SNS 发送事件
- SNS 将事件发送到我代码中的端点
- 代码运行之前定义的函数getJobOutputDuration
Ps: 我注意到当我在几分钟后尝试运行相同的代码时,它确实正确地返回了输出持续时间
回答如下:更多推荐
AWS SDK ElasticTranscoder readJob 返回未定义
发布评论