vogels icon indicating copy to clipboard operation
vogels copied to clipboard

Using attribute name "length" in schema causes serializer to fail silently on create

Open ghost opened this issue 10 years ago • 5 comments

I've been tracing the generated params in table.js before they are sent to the docClient, and any time you attempt to use a schema with the attribute name "length" in it, self.serializer.serializeItem(self.schema, attrs) just returns an empty object. Changing the attribute name to something else fixes it.

ghost avatar Jul 17 '15 18:07 ghost

This is on 2.0.0-rc10

ghost avatar Jul 17 '15 19:07 ghost

Thats a wacky bug, I'll look into this asap (probably over the weekend)

ryanfitz avatar Jul 17 '15 20:07 ryanfitz

Wow I wish I would have found this earlier.... It seems to be something in lodash's reduce function

chadkouse avatar Feb 04 '16 05:02 chadkouse

lodash has a function _.isArrayLike() which is used by a number of functions, including _.map. If a collection passed to _.isArrayLike() includes a length property then it will be treated as an array.

See this issue for advice on other methods to use where collection is known to be an object: https://github.com/lodash/lodash/issues/1870

deedw avatar Feb 04 '16 11:02 deedw

This appears to still be an issue as of 2.2.0, I just got bitten by this.

lrettig avatar Mar 13 '17 18:03 lrettig