question

Fabio Eremita avatar image
Fabio Eremita asked

I am having trouble connecting to the audio file U.R.I.


I uploaded the jazz.mp3 file in the media folder to my S3 storage. when I run my skill with this code:
handle(handlerInput)
    {
        const audioUrl = Util.getS3PreSignedUrl("Media/jazz.mp3").replace(/&/g,'&');

        return handlerInput.responseBuilder
            .speak(`hello world with audio <audio src="${audioUrl}"/>`)
            .getResponse();
    }

i have message froma Alexa: "I am having trouble connecting to the audio file U.R.I."

help me please!


skillaudioamazon developer portal
3 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joseph Kesselman avatar image Joseph Kesselman commented ·

A few debugging thoughts:

Try printing out that URL, to make sure it's actually what you expect it to be.


Remember that S3 does not actually have directories, though utilities may use / in the object name to provide behavior that simulates directories. That can sneak up and bite you if you aren't careful. Make sure there really is an object in your S3 named exactly "Media/jazz.mp3", and is in the bucket associated with your skill rather than in other S3 storage.
0 Likes 0 ·
Fabio Eremita avatar image Fabio Eremita Joseph Kesselman commented ·
I think it's a permissions problem because when I upload the file I don't have API permissions, how can I unlock it?
0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth Fabio Eremita commented ·

If you're using the Alexa hosted S3 bucket associated with your Alexa hosted skill then it won't be a permissions issue. In my experience, the URL produced by the getS3PreSignedUrl function call is so complex (with multiple URL parameters etc) that it is incompatible with use via the SSML <audio> tag. If I were you, I would host the audio files outside of the Alexa hosted bucket e.g. in a S3 bucket associated with your Amazon developer account. This will work.

0 Likes 0 ·

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

Exactly the same for me. I wouldn't bother using the Alexa hosted S3 bucket for audio, lots of people having problems like this.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.