Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add aws session token #39

Merged
merged 2 commits into from
Dec 12, 2023
Merged

Conversation

yurik94
Copy link
Contributor

@yurik94 yurik94 commented Nov 15, 2023

Hello,
Many thanks for this OS package!

I'm using it in a project deployed on AWS Lambda (Bref + Serverless framework), locally with Sail it worked but when deploying it on AWS I was getting:

Aws\Polly\Exception\PollyException
Error executing "SynthesizeSpeech" on "https://polly.eu-central-1.amazonaws.com/v1/speech"; AWS HTTP error: Client error: `POST https://polly.eu-central-1.amazonaws.com/v1/speech` resulted in a `403 Forbidden` response:
{"message":"The security token included in the request is invalid."}
 UnrecognizedClientException (client): The security token included in the request is invalid. - {"message":"The security token included in the request is invalid."}

I've added the AWS_SESSION_TOKEN config field which allows the AWS SDK to work even when using an assumed IAM role.

This allows AWS to load also the AWS_SESSION_TOKEN in order for lambda to work as IAM key and secret are empty
@luigel luigel merged commit 75ba48c into meemalabs:main Dec 12, 2023
8 checks passed
@luigel
Copy link
Collaborator

luigel commented Dec 12, 2023

Hi @yurik94 Thank you for the PR. It is also great if you add some simple documentation in the README on how to use the token.

Added release for this in https://github.com/meemalabs/laravel-text-to-speech/releases/tag/v1.5.2

@danielbehrendt
Copy link

This PR seems to break previous implementations! Getting an error:

Undefined array key "token"

@Sergiobop
Copy link

Sergiobop commented Jan 2, 2024

Yeah, this one breaks my app too..

To fix it, i changed my tts.php config file to:

  'credentials' => [
                'key'     => env('AWS_ACCESS_KEY_ID', ''),
                'secret'  => env('AWS_SECRET_ACCESS_KEY', ''),
                'token'   => env('AWS_SESSION_TOKEN', ''), // ADDED THIS LINE
            ],

Maybe updating readme to reflect this is the way to go?

@BassemBouguerraIn
Copy link

@Sergiobop plz how get AWS_SESSION_TOKEN value

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants