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달 전177회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠