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

Throws "must contain Id and SyncToken fields" even when both are present. #59

Closed
camikazegreen opened this issue Jun 29, 2016 · 2 comments

Comments

@camikazegreen
Copy link

When trying to update a Vendor, I get the message:

Error: vendor must contain Id and SyncToken fields: { Id: 505, SyncToken: 1, sparse: true, TaxIdentifier: '123456789' }

I tracked this down to module.update() in the index.js file.

_.isEmpty(entity.SyncToken) returns true when you pass through a string or an integer of one digit.

According to the lodash docs: "Array-like values such as arguments objects, arrays, buffers, strings, or jQuery-like collections are considered empty if they have a length of 0. Similarly, maps and sets are considered empty if they have a size of 0."
_.isEmpty(1); // → true

It works fine if I remove the two _.isEmpty tests, and I'd be happy to submit a pull request to remove them, but I'm sure that you have a reason for them, or an alternate way to submit the SyncToken that would work. Your example code uses SyncToken: 1

@mcohen01
Copy link
Owner

The Id and SyncToken fields need to be strings rather than integers.

mcohen01 added a commit that referenced this issue Jun 29, 2016
@mcohen01
Copy link
Owner

v 2.0.10 is on npm

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

No branches or pull requests

2 participants