Non-existent table with local dynamoDB
I am running local dynamoDB (2016-05-17) on port 8000. As described here the local jar file is created - cUniqueSessionID_us-west-2.db. New table - users - was successfully created from local Javascript shell
"TableDescription" {
"AttributeDefinitions" [
0: {
"AttributeName":"name"
"AttributeType":"S"
"TableName":"users"
"KeySchema" [
0: {
"AttributeName":"name"
"KeyType":"HASH"
"TableStatus":"ACTIVE"
"CreationDateTime":"2016-08-17T04:42:35.614Z"
"ProvisionedThroughput" {
"LastIncreaseDateTime":"1970-01-01T00:00:00.000Z"
"LastDecreaseDateTime":"1970-01-01T00:00:00.000Z"
"NumberOfDecreasesToday":0
"ReadCapacityUnits":1
"WriteCapacityUnits":1
"TableSizeBytes":0
"ItemCount":0
"TableArn":"arn:aws:dynamodb:ddblocal:000000000000:table/users"
I am able to add an item to the table from local Javascript shell but not from jcabi-dynamo.
This is not working although I think it should:
final Credentials cred = new Credentials.
Direct(new Credentials.Simple("cUniqueSessionID", ""), 8000);
final Region region = new ReRegion(new Region.Simple(cred));
final Table table = region.table("users");
final ImmutableMap.Builder<String, AttributeValue> map =
new ImmutableMap.Builder<>();
map.put("name", new AttributeValue("name"));
map.put("password", new AttributeValue("2B9keW"));
table.put(map.build());
[BkParallel-6] WARN com.jcabi.dynamo.retry.ReTable - #put(): attempt #3/3 failed with java.io.IOException in 188ms (26s in total): failed to put into "users" with {name={S: name,}, password={S: 2B9keW,}, email={S: w@ksak,}, country={S: none,}, code={S: ea13643,}}; Cannot do operations on a non-existent table (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ResourceNotFoundException; Request ID: 297692d5-ebb4-4dc6-9f6e-5c8908fb0a22)
Also tried defining region explicitly with new Credentials.Simple("cUniqueSessionID", "", "us-west-2") but the exception was the same.
FYI: I am running jcabi-dynamo v0.20.
@yegor256 please do something about it, see par.21
@piotrkot looks like table users is not created. you should post your entire code, maybe I'll be able to help
@yegor256 The table seems to be fine. It was created from JS shell command with following instructions:
var params = {
TableName: 'users',
KeySchema: [
{
AttributeName: 'name',
KeyType: 'HASH',
}
],
AttributeDefinitions: [
{
AttributeName: 'name',
AttributeType: 'S',
}
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1,
},
};
dynamodb.createTable(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
Later I checked this table description and it also seems fine (listed in the first comment). As I said I was able to add item into the table from JavaScript shell but not from jcabi-dynamo.
@yegor256 That is all the code I have. JS to create a table, JS to check table description (to verify its OK), JS to add an item, and Java code to add the item with jcabi-dynamo. The Java code throws exception. The JS code are original snippets that the local shell (localhost:8000/shell) generated for me.
@yegor256 It is really simple to reproduce. Please, let me know what you are missing.
@yegor256 ping
@dmarkov @yegor256 ping
@piotrkot honestly, I have no idea what's wrong. Obviously, jcabi-dynamo works fine with DynamoDBLocal, you can see them in a few projects, for example here: https://github.com/yegor256/jare All I can suspect is that you drop your DynamoDBLocal before running Java tests. Make sure it's not happening.
I have a similar problem with local dynamoDB and I use python. Initially table was all right, i created it, put items in it, and was able to scan() or query(). And after a while, the table will just disappear and become 'non-exisiting'... I'm pretty confused since I run it locally, so there shouldn't be any user or region problem (:зゝ∠)
ps: i tested dynamoDB local previous ( create a table, restart the machine, and the table was still there. Hum)
I've got the same problem, it's pretty strange as the table is obviously created and present, but jvm app connected to that endpoint cannot see the table https://github.com/akka/akka-persistence-dynamodb/issues/47#issuecomment-334290000
Resolved here https://stackoverflow.com/a/29560004/306488
com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException: Cannot do operations on a non-existent table (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ResourceNotFoundException; Need help