sensedeep / dynamodb-onetable

DynamoDB access and management for one table designs with NodeJS
https://doc.onetable.io/
MIT License
689 stars 109 forks source link

Connecting OneTable to a local dynamodb instance #515

Closed evanwang-powerschool closed 11 months ago

evanwang-powerschool commented 11 months ago

Hello, Hopefully this is the right place to ask this. We are trying to run a cdk app with SAM CLI. We have a local dynamo db instance stood up in docker that we can hit via cmd. We are using the onetable library. It works well when fully deployed, but I cannot figure out how to get it to connect to our local dynamodb instance.

I am trying to connect to it like this:

  const dynamoDB = new AWS.DynamoDB.DocumentClient(
{
endpoint: 'http://localhost:8000'
});

  return new Table({
    name: tableName,
    client: dynamoDB,
    schema: MainDdbTableSchema
  });

but whenever I attempt to execute a query, I get an error like this: UnknownEndpoint: Inaccessible host: localhost' at port8000'. This service may not be available in the `us-east-1' region.

As far as my understand goes, onetable just wraps the aws dynamodb client so I would think this should work. Am I missing something?