Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-existent table with local dynamoDB #78

Open
piotrkot opened this issue Aug 17, 2016 · 14 comments
Open

Non-existent table with local dynamoDB #78

piotrkot opened this issue Aug 17, 2016 · 14 comments

Comments

@piotrkot
Copy link

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)
@piotrkot
Copy link
Author

Also tried defining region explicitly with new Credentials.Simple("cUniqueSessionID", "", "us-west-2") but the exception was the same.

@piotrkot
Copy link
Author

FYI: I am running jcabi-dynamo v0.20.

@dmarkov
Copy link

dmarkov commented Aug 22, 2016

@yegor256 please do something about it, see par.21

@yegor256
Copy link
Member

@piotrkot looks like table users is not created. you should post your entire code, maybe I'll be able to help

@piotrkot
Copy link
Author

@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.

@piotrkot
Copy link
Author

@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.

@piotrkot
Copy link
Author

piotrkot commented Sep 6, 2016

@yegor256 It is really simple to reproduce. Please, let me know what you are missing.

@piotrkot
Copy link
Author

piotrkot commented Oct 4, 2016

@yegor256 ping

@piotrkot
Copy link
Author

@dmarkov @yegor256 ping

@yegor256
Copy link
Member

@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.

@tobyatgithub
Copy link

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)

@l15k4
Copy link

l15k4 commented Oct 4, 2017

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 akka/akka-persistence-dynamodb#47 (comment)

@l15k4
Copy link

l15k4 commented Oct 4, 2017

Resolved here https://stackoverflow.com/a/29560004/306488

@greensky-code
Copy link

com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException: Cannot do operations on a non-existent table (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ResourceNotFoundException;
Need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants