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

Migrate table exists but not found on Shell

Open tbnoy opened this issue 6 years ago • 1 comments

Actual Behaviour

I'm using serverless with python and using docker with dynamo: https://github.com/dwmkerr/docker-dynamodb

now created the docker container with port 8000 shared with localhost. ie:

dynamo:
    image: dwmkerr/dynamodb
    ports:
      - "8000:8000"

then after I activate the container, I run the migrate command: sls dynamodb migrate --account local --port 8000 --host 127.0.0.1

Im aiming to my localhost on port 8000 as the port is shared with the docker container.

now when I run the command for the first time, it says the table was created. That's great. When I run for the second time, it says: table already exists. That's great.

But when I access the shell on http://localhost:8000/shell/ and try to list the tables, I dont see it...

Any ideas what is missing here?

Expected Behaviour

created table, do not appear on shell.

Steps to reproduce it

  • create a docker-compose file with the image above
  • create the container and let it run
  • run the dynamo migrate command while pointing to that dynamo instance
  • check tables on shell

LogCat for the issue

no crash.

tbnoy avatar Aug 27 '18 08:08 tbnoy

I had a similar problem, explicitly defining the accessKeyId and secretAccessKey to what is used in the migration seemed to fix it for me:

const conn = {
  region: 'localhost',
  endpoint: 'http://localhost:8000',
  accessKeyId: 'MOCK_ACCESS_KEY_ID',
  secretAccessKey: 'MOCK_SECRET_ACCESS_KEY',
};

const db = new AWS.DynamoDB(conn);
db.listTables({}, console.log);

SamCB avatar Dec 18 '18 05:12 SamCB