1 Answer
- Newest
- Most votes
- Most comments
0
This error is likely caused by sending non-key attributes in the GetItem call. When you use MarshalMap, it is including a null value for all other attributes in the key object.
Either you can construct the key manually:
Key: map[string]*dynamodb.AttributeValue{
"userId": {
S: aws.String("2323"),
},
"username": {
S: aws.String("The Big New Movie"),
},
},
Or add omitempty to the struct fields, which will exclude these attributes from the marshalled map when they have no value:
type Movie struct {
Year int `json:"year,omitempty"`
Title string `json:"title,omitempty"`
[...]
}
answered 3 years ago
Relevant content
- asked 5 years ago
- asked 3 years ago

That worked but only with primary key and sort key, If I try to make a call like this I get the same error again ~ movie := structs.UserDetails{ HandleName: "Da", BankDetails: "xs", UserId: "fsd", }