在将文件上传到存储桶后,我正在尝试在 AWS Lambda 中使用 Ruby 启动 MediaConvert 作业。活动开始得很好,但我在开始工作时遇到了麻烦。
我试图按照此处的说明启动客户端:https ://docs.aws.amazon.com/sdkforruby/api/Aws/MediaConvert/Client.html
# Event to kick off the media conversion: file uploaded to a bucket
sourceS3Bucket = event['Records'][0]['s3']['bucket']['name']
sourceS3Key = event['Records'][0]['s3']['object']['key']
sourceS3 = 's3://'+ sourceS3Bucket + '/' + sourceS3Key
jobMetadata['input'] = sourceS3
# Loading the MediaConvert settings
json_from_file = File.read('job.json')
jobSettings = JSON.parse(json_from_file)
# Initiating a client
client = Aws::MediaConvert::Client.new(
access_key_id: ENV['ACCESS_KEY_ID'],
secret_access_key: ENV['SECRET_ACCESS_KEY']
)
# Kicking off a job
response = client.create_job({
Role: ENV['MediaConvertRole'],
UserMetadata: jobMetadata,
Settings: jobSettings
})
我收到此错误:
Critical exception from handler
{
"errorMessage": "uninitialized constant Aws::MediaConvert",
"errorType": "Function<NameError>",
"stackTrace": [
"/var/task/convert.rb:38:in `rescue in call'",
"/var/task/convert.rb:6:in `call'"
]
}
我不确定为什么该功能会失败,请问您有任何线索吗?