I'm using the AWS SDK for Javascript and, I have this code for reading a job:
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;
}
But sometimes, the outputDuration
returns undefined
. The code flow is:
- Trigger a job on ElasticTranscoder
- Save the
Elastic Transcoder jobId
on the database - Once ElasticTranscoder finishes, it saves the output file in an S3 bucket
- The S3 bucket emits an event to SNS
- SNS sends the event to an endpoint in my code
- The code runs the function getJobOutputDuration previously defined
Ps: I noticed that when I try to run the same code after a few minutes, it does return the output duration correctly