404 for Polly mp3 generated into s3 bucket

0

I think this might be an issue with S3 Access rights/permissions, but I am lost as to how to proceed.

I create a mp3 file with this: $result_audio = $client->startSpeechSynthesisTask([ 'Engine' => 'standard', 'OutputFormat' => 'mp3', 'OutputS3BucketName' => 'BUCKET', 'Text' => $chunk_text, 'VoiceId' => $row_data['cv_service_id'] ]);

$s3KeyName = substr($result_audio['SynthesisTask']['OutputUri'], 43);

$s3->copyObject([ 'Bucket' => 'BUCKET', 'Key' => urlencode($new_id.'.mp3'), 'CopySource' => "BUCKET/".urlencode($s3KeyName), ]);

I replaced my bucket with BUCKET for this post.

I get a 404 not found on the copy object, even though I have double checked that the temp file is created. It is auto generated by Amazon Polly and I cannot change the way it is saved. It does not contain anything I think needs to be urlencoded, but I added that to make sure.

An example of the $s3KeyName: 3b7901d6-52af-44ce-9993-b2f805153e85.mp3

I have used the Policy simulator to check that the IAM user credentials have access: https://policysim.aws.amazon.com/home/index.jsp I checked the following permissions: S3 DeleteObject GetObject PutObject GetObjectTagging PutObjectTagging PutObject ListAllMyBuckets

s3express CreateSession

I have granted the IAM user full access to s3 and s3 express, but still nothing changes. I do have the bucket set to prevent public access with all options checked, but I don't think that should stop an authenticated IAM user?

There is no way to set the filename when creating an Amazon Polly mp3 file with startSpeechSynthesisTask, right?

Any guidance what I should do?

anet
已提问 3 个月前182 查看次数
1 回答
1

The startSpeechSynthesisTask creates an asynchronous synthesis task. Therefore, immediately after startSpeechSynthesisTask is executed, the audio file may not be ready.

You may want to use the getSpeechSynthesisTask to wait until the TaskStatus becomes completed.

https://docs.aws.amazon.com/polly/latest/dg/API_StartSpeechSynthesisTask.html https://docs.aws.amazon.com/polly/latest/dg/API_GetSpeechSynthesisTask.html

profile picture
专家
shibata
已回答 3 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则