Serverless Error - The security token included in the request is invalid


I’m doing this tutorial but when I get to the part to deploy the application with sls deploy I get the message below:

$ serverless deploy
Serverless: Packaging service...

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

ServerlessError: The security token included in the request is invalid.

Get Support --------------------------------------------

Your Environment Information -----------------------------
   OS:                     win32
   Node Version:           6.9.1
   Serverless Version:     1.17.0

The file serverless.yml is the same as showed in the tutorial:

service: candidate-service

frameworkVersion: ">=1.1.0 <2.0.0"

  name: aws
  runtime: nodejs4.3
  stage: dev
  region: us-east-1

    handler: api/candidates.submit
    memorySize: 128
    description: Submit candidate information and starts interview process.
      - http: 
          path: candidates
          method: post

How can I fix this, where I add the token and what is this token, the access key?

1 Like

Looks like your AWS credentials aren’t configured on your machine.

Double check they are setup

Here is the guide on configuring those


Ty man, I just needed to change my secret key :smiley:

In my case I am on aws sso credentials. It is refreshed. The ~/.aws/credentials is up to date which includes a token. I understand serverless looks there and ignores ~/.aws/config. But it does not work with --aws-profile or without it but with sls config credentials either. Very annoying. Strange thing is it was working fine 12 hours ago and today there is no luck at all.

I’m getting the same error. Were you able to deploy?