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

Put request with non existent properties result in error #45

Closed
erikverheij opened this issue May 22, 2015 · 3 comments
Closed

Put request with non existent properties result in error #45

erikverheij opened this issue May 22, 2015 · 3 comments

Comments

@erikverheij
Copy link

Put requests having non existent properties (properties that do not exists in the model definition) are resulting in the following error;

TypeError: Cannot read property 'id' of undefined
    at MySQL.SQLConnector.buildFields (\loopback-connector-mysql\node_modules\loopback-connector\lib\sql.js:861:24)
    at MySQL.SQLConnector.buildFieldsForUpdate (\loopback-connector-mysql\node_modules\loopback-connector\lib\sql.js:892:21)
    at MySQL.SQLConnector.buildUpdate (\loopback-connector-mysql\node_modules\loopback-connector\lib\sql.js:583:21)
    at MySQL.SQLConnector.update (\loopback-connector-mysql\node_modules\loopback-connector\lib\sql.js:601:19)
    at MySQL.SQLConnector.updateAttributes (\loopback-connector-mysql\node_modules\loopback-connector\lib\sql.js:570:8)
    at ModelConstructor.<anonymous> (\loopback-datasource-juggler\lib\dao.js:2253:23)
    at ModelConstructor.trigger (\loopback-datasource-juggler\lib\hooks.js:65:12)
    at ModelConstructor.<anonymous> (\loopback-datasource-juggler\lib\dao.js:2218:14)
    at ModelConstructor.trigger (\loopback-datasource-juggler\lib\hooks.js:65:12)
    at \loopback-datasource-juggler\lib\dao.js:2217:12

The field builder could just skip the property when it is not in the model definition. Perhaps it is even better to remove such properties before it hits the data connector layer?

@raymondfeng
Copy link
Contributor

Good catch. I'll fix it.

raymondfeng pushed a commit to loopbackio/loopback-connector that referenced this issue May 22, 2015
raymondfeng pushed a commit to loopbackio/loopback-connector that referenced this issue May 22, 2015
 * Fix for loopbackio/loopback-connector-mssql#45 (Raymond Feng)

 * Fix the jsdoc for applyPagination (Raymond Feng)
@raymondfeng
Copy link
Contributor

Fixed by loopback-connector@2.1.2

@erikverheij
Copy link
Author

Thanks for the quick fix!

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