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

Hello.

I’m doing this tutorial https://serverless.com/blog/node-rest-api-with-serverless-lambda-and-dynamodb/ 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 --------------------------------------------
   Docs:          docs.serverless.com
   Bugs:          github.com/serverless/serverless/issues
   Forums:        forum.serverless.com
   Chat:          gitter.im/serverless/serverless

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"

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

functions:
  candidateSubmission:
    handler: api/candidates.submit
    memorySize: 128
    description: Submit candidate information and starts interview process.
    events:
      - 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 https://serverless.com/framework/docs/providers/aws/guide/credentials/

2 Likes

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?