Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Item.objectFromSchema] Query with condition on string set cause array is not a function #1633

Open
Hideman85 opened this issue Sep 6, 2023 · 0 comments

Comments

@Hideman85
Copy link

Sorry for the short description but it took me quite some times already to find the issue. Then reading the code it normal that the potential array is not a function.

Context query with contains condition on a string set, it calls toDyamo with set modifier on the field, and it fails cause it get an array and this is not callable.
There is Array.isArray above with array.some but then consider it as a function only a few line down.

image

And this called by:

            // This function returns the DynamoDB property name for a given attribute (alias or property name). For example if you have a `pk` with an alias of `userID` and pass in `userID` it will return `pk`. If you pass in `pk` it will return `pk`.
            "dynamoPropertyForAttribute": async (attribute) => {
                const obj = await Item.objectFromSchema({ [attribute]: true }, this, { "type": "toDynamo", "modifiers": ["set"], "typeCheck": false, "mapAttributes": true });
                return Object.keys(obj)[0];
            },

I'm not so sure why the set modifier need to be called here specially if the attribute is set to true, this does not really work, is it?

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

No branches or pull requests

1 participant