serverless-dynamodb-local icon indicating copy to clipboard operation
serverless-dynamodb-local copied to clipboard

MissingAuthenticationToken

Open dominikabieder opened this issue 5 years ago • 1 comments

Actual Behaviour

A work friend has set up serverless dynamodb local, making a GET request to localhost works for her, but it doesn't for me. We have the same code, with the difference that I'm using a new laptop.

Whenever I curl -v 'http://localhost:5001/users/123'

I get

 Connection #0 to host localhost left intact
{"__type":"com.amazonaws.dynamodb.v20120810#MissingAuthenticationToken","message":"Request must contain either a valid (registered) AWS access key ID or X.509 certificate."}* Closing connection 0

config.js

export const DB_CONFIG = {
  region: process.env.AWS_REGION || 'localhost',
  endpoint: process.env.DYNAMO_DB_ENDPOINT,
  accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'DEFAULT_ACCESS_KEY',
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'DEFAULT_SECRET',
  sessionToken: process.env.AWS_SESSION_TOKEN
}

.env.yml

local:
  AWS_REGION: 'localhost'
  DYNAMO_DB_ENDPOINT: 'http://localhost:8000'
  AWS_ACCESS_KEY_ID: 'DEFAULT_ACCESS_KEY'
  AWS_SECRET_ACCESS_KEY: 'DEFAULT_SECRET'
  AWS_SESSION_TOKEN: 'DEFAULT_SESSION_TOKEN'
  USERS_TABLE_NAME: 'name-of-our-table-local'

sandbox:
  USERS_TABLE_NAME: 'name-of-our-table-sandbox'

I don't really know how to solve that issue.

dominikabieder avatar Jan 15 '20 13:01 dominikabieder

For me it was because I was running serverless-offline and dynamodb on the same port. Changing the port for serverless-offline to 8080 fixed it.

otheabould avatar May 25 '22 16:05 otheabould