Closed chrisbrantley closed 4 years ago
Hi @chrisbrantley Thanks for opening the issue and to provide the code to reproduce it.
This fail happens due to the inability of dynamo-easy to handle null values -> it filters out all null/undefined/empty values.
We will address this in the near future and bring null-value support to dynamo-easy; see #285 stay tuned!
I need to update an array with an empty array and get the same error. Setting something to an empty array seems like a valid usecase.
I am facing the same issue as @fredspivock often you want to have lists of objects that can be added and removed, via updating, and a very common scenario is setting that list back to being empty. Removing is not really an option as you want that empty array so you can append objects.
so just to explain further this call does not work and results in Cannot convert undefined or null to object
which comes from
object mapper toDb call.
example would be in terms of update operations
const operation = update2(Breakfast, 'eggs').set([]);
// this currently does not work it kind of should
happy to do make this change if you can point me to a good starting point.
its here that an empty array will would filtered via the deepfiler call which would always return []
for any empty array instead
of [[]]
without knowing the full details of deepfilter and why it rejects empty array I cannot really deep dive into a fix here. I can make one but it will be hack
Describe the bug I'm trying to update some attributes to
null
or[]
(empty array) and I'm getting the following error:To Reproduce
Expected behavior Since both Null and empty arrays are valid DynamoDB values I would expect the operation to succeed.
Additional context This error only happens with update operations. I can call
store.put()
with the same values and it works correctly.I am using Typescript.