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

An AttributeValue may not contain an empty string #32

Open
SamVerschueren opened this issue Nov 27, 2015 · 7 comments
Open

An AttributeValue may not contain an empty string #32

SamVerschueren opened this issue Nov 27, 2015 · 7 comments

Comments

@SamVerschueren
Copy link
Owner

If some properties are empty strings, the insert/update fails. Should we filter out those empty strings or is it up to the user?

example

const key = {
    email: '[email protected]'
};

const values = {
    name: {
       firstName: 'Sam',
       name: ''
    }
};

User.insert(key, values).exec().catch(err => {
    //=> ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An AttributeValue may not contain an empty string for key :v_name
});
@SamVerschueren
Copy link
Owner Author

@SamVerschueren SamVerschueren added this to the v0.7.0 milestone Jan 25, 2016
@SamVerschueren SamVerschueren modified the milestones: v0.8.0, v0.7.0 Mar 2, 2016
@SamVerschueren SamVerschueren removed this from the v0.8.0 milestone Jul 11, 2016
@mikedizon
Copy link

"Converting empty values to null is now an opt-in feature of the document client; you can pass a boolean convertEmptyValues option to the document client constructor to have it do so. I'll open a PR to improve the documentation of this feature."

aws/aws-sdk-js#833

@SamVerschueren
Copy link
Owner Author

Cool, we should definitely add it and I believe the best default is to make it opt-out and do this by default. Thanks for letting me know @mikedizon! Much appreciated.

@mikedizon
Copy link

If set, it seems to be setting blank values to true. Not sure what's causing it.

@SamVerschueren
Copy link
Owner Author

Might be a bug in the SdK itself. Will have a look at it tomorrow.

@AaronHarris
Copy link

Any update?

@SamVerschueren
Copy link
Owner Author

SamVerschueren commented Sep 24, 2017

I looked at the issue thread regarding the convertEmptyValues. All it does is replace empty strings with null. Not sure if I like that behaviour... Have to test it out first. Most of the time, when I'm uncertain about some values, I run the data object through obj-clean.

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

3 participants