Serverless no longer deploying resources - errors instantly

I’ve been using Serverless for some time now and have not had this problem before. When I run sls deploy -v --stage dev, I’m now getting this error:

Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: AWS SES template synchronization start

  Serverless Error ---------------------------------------

  The security token included in the request is expired

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.10.1
     Framework Version:         2.21.1
     Plugin Version:            4.4.2
     SDK Version:               2.3.2
     Components Version:        3.6.0

I’ve made sure that the correct AWS profile is being used. I’ve also tried exporting environment variables but still no luck. We are using the AWS SSO portal so credentials change.

I was having this issue with 2.19.0 and have just upgraded to the latest release of Serverless. Any ideas folks?

1 Like

So I still have no idea why Serverless stopped respecting my AWS credential env variables… I’ve managed to work around the issue using a script a colleague of mine wrote:

I now need to run aws2-wrap --profile ProfileName --exec "sls deploy -v --stage dev"

Where ProfileName relates to an entry in ~/.aws/config like:

[profile ProfileName]
sso_start_url = https://foobar.awsapps.com/start
sso_region = us-east-1
sso_account_id = 12342323423
sso_role_name = Role
region = us-east-1
output = json

Hi, I’m contributing to an open-source project that aims to solve this credentials problem with exteernal libraries like SLS and this is the exact use case.
Take a look at Leapp: GitHub - Noovolari/leapp: Leapp is the tool to access your cloud; It securely stores your access information and generates temporary credential sets to access your cloud ecosystem from your local machine.