dynamodb icon indicating copy to clipboard operation
dynamodb copied to clipboard

Table name adds 's' character

Open KromDaniel opened this issue 8 years ago • 2 comments

Hey, I'm getting the next error, after defining the next scheme: (edited the real names)

const model = dynamo.define("my_table_name", {
	hashKey: "the_hash_key",
});

getting the error

is not authorized to perform: dynamodb :GetItem on resource: arn:aws:dynamodb:us-east-11234:table/my_table_names'

I wrote my_table_name and for some reason it tries to access my_table_names

when editing on lib\index.js the line

var tableName = name.toLowerCase() + 's';

to var tableName = name.toLowerCase()

it works

KromDaniel avatar May 04 '17 14:05 KromDaniel

Use the "tableName" property in the options (next to hashKey) to specify a different table name. You should also be calling dynamo.createTables so it handles creating those tables for you anyway.

Matheus28 avatar May 11 '17 04:05 Matheus28

This tripped me up for quite a while. Might be worth making a note of it in the Readme?

mikeymclellan avatar May 24 '17 20:05 mikeymclellan