https://pulumi.com logo
Title
g

great-postman-59271

11/09/2021, 1:51 PM
I am having issues with the DynamoDB TableItem resource. I have tried to create one Item with what appears to me to be valid JSON. It also seems to have created the actual Item in the table, but the pulumi up still failed with the following message:
error: 1 error occurred:
        * updating urn:pulumi:dev::ThreeShape.Olympus.Auth.Infrastructure::aws:dynamodb/tableItem:TableItem::IntegrationTestAccessKey: 1 error occurred:
        * Error retrieving DynamoDB table item: SerializationException:
        status code: 400, request id: 1AE7FL7RD378QAOE1745B5TCDVVV4KQNSO5AEMVJF66Q9ASUAAJG
I have tried the example code here, and that works fine. Have anyone else experienced this?
📣 1
im working with pulumi 3.17 on writing infrastructure in C# btw
b

billowy-army-68599

11/09/2021, 2:50 PM
@great-postman-59271 can you share your code?
g

great-postman-59271

11/09/2021, 3:12 PM
I can but i actually found the issue now: I had accidentially provided the Value of the Partition and Range keys for the TableItem.HashKey and RangeKey properties. For some reason the creation succeeded but i think the whole operation failed when receiving the reply back from AWS, where the Keys would not match what pulumi expected. So the error was mine (thank god 🙂 ) but i think the way it failed could have been much nicer. First of all the exception message was not very informative. Second of all, the tableitem resource got into a state where i could not delete it again. I had to delete i manually in the AWS console and then modify the pulumi state to exclude the resource to remove it again. Modifying the code from here to reproduce the issue, i can do it with this:
var exampleTable = new Table("exampleTable", new TableArgs
            {
                ReadCapacity = 10,
                WriteCapacity = 10,
                HashKey = "exampleHashKey",
                Attributes =
                {
                    new TableAttributeArgs
                    {
                        Name = "exampleHashKey",
                        Type = "S",
                    },
                },
            });
            var exampleTableItem = new TableItem("exampleTableItem", new TableItemArgs
            {
                TableName = exampleTable.Name,
                HashKey = "SomeKey",
                Item = @"{
  ""exampleHashKey"": {""S"": ""something""},
  ""one"": {""N"": ""11111""},
  ""two"": {""N"": ""22222""},
  ""three"": {""N"": ""33333""},
  ""four"": {""N"": ""44444""}
}
",
            });
Note the only difference is the value of the HashKey property for TableItem
👍 1
should this be submitted in some bug report?
b

billowy-army-68599

11/09/2021, 3:20 PM
@great-postman-59271 there's not much we can do here, the error you receive comes from the AWS API
a bug for the incorrect doc would be good though
g

great-postman-59271

11/10/2021, 7:28 AM
damn, thats a shame. Well at least i figured it out. What do you mean about the incorrect doc? You mean my example above? That was edited by me to induce the error, the one you have in your documentation works 🙂