Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Missing the key in the item when calling transaction.save() #34

Open
chgangaraju opened this issue Jan 31, 2017 · 1 comment
Open

Missing the key in the item when calling transaction.save() #34

chgangaraju opened this issue Jan 31, 2017 · 1 comment

Comments

@chgangaraju
Copy link

chgangaraju commented Jan 31, 2017

I am trying to save a Item in DynamoDB using Lambda. If i replace the code with DynamoDBMapper. It works perfectly. I am using @DynamoDBAutoGeneratedKey annotation to generate the Id. Its not working even if i send the integration_endpoint_id explicitly.

Transaction transaction = txManager.newTransaction();
transaction.save(integrationEndpoint);
transaction.commit();

stacktrace:

{
  "errorMessage": "One or more parameter values were invalid: Missing the key integration_endpoint_id in the item (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: KG2DI2R78HR8ULKFSLPE36LJ5FVV4KQNSO5AEMVJF66Q9ASUAAJG)",
  "errorType": "com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException",
  "stackTrace": [
    "com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1387)",
    "com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:940)",
    "com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:715)",
    "com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:466)",
    "com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:427)",
    "com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:376)",
    "com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.doInvoke(AmazonDynamoDBClient.java:2078)",
    "com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:2048)",
    "com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.putItem(AmazonDynamoDBClient.java:1584)",
    "com.amazonaws.services.dynamodbv2.transactions.TransactionItem.insert(TransactionItem.java:168)",
    "com.amazonaws.services.dynamodbv2.transactions.TransactionItem.<init>(TransactionItem.java:111)",
    "com.amazonaws.services.dynamodbv2.transactions.TransactionItem.<init>(TransactionItem.java:81)",
    "com.amazonaws.services.dynamodbv2.transactions.Transaction.<init>(Transaction.java:144)",
    "com.amazonaws.services.dynamodbv2.transactions.TransactionManager.newTransaction(TransactionManager.java:140)",
@Yanacek
Copy link
Contributor

Yanacek commented Apr 26, 2018

While we look at the bug, the workaround would be to remove the DynamoDBAutoGeneratedKey and generate the UUID yourself in your code. This could be pretty tricky to fix depending on when the mapper generates the primary key, so I worry that this is one we won't be able to fix in practice.

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

No branches or pull requests

2 participants