0

嗨,我将转录作业调用到 AWS lambda 函数,但我找不到任何创建的作业角色,我在云监视日志中看到了这个错误。谁能帮我解决这个问题,我遇到了 3 天的麻烦,但我不能找到任何解决方案。

这是这里的错误消息

这是这里的错误消息

'use strict';
var aws = require('aws-sdk');
var s3 = new aws.S3();
var transcribeservice = new aws.TranscribeService();

exports.handler = (event, context, callback) => {
    console.log('Received event:', JSON.stringify(event, null, 2));
    var bucket = event.Records[0].s3.bucket.name;
    var key = event.Records[0].s3.object.key;    
    var newKey = key.split('.')[0];
    var str = newKey.lastIndexOf("/");
    newKey = newKey.substring(str+1);
    
    var inputaudiolocation = "https://s3.amazonaws.com/search-video/inputaudio/";
    var mp3URL = inputaudiolocation+newKey+".mp3";
    var outputbucket = "search-video";
    var params = {
        LanguageCode: "en-US", /* required */
        Media: { /* required */
          MediaFileUri: mp3URL
        },
        MediaFormat: "mp3", /* required */
        TranscriptionJobName: newKey, /* required */
        MediaSampleRateHertz: 44100,
        OutputBucketName: outputbucket
      };
      transcribeservice.startTranscriptionJob(params, function(err, data){
      if (err){
       console.log('Received event:Error = ',err);
      } else {
       console.log('Received event:Success = ',data);
      }
     });
};
'''
Thanks in Advance !!!
4

0 回答 0