Custom id field does not work in get request with id
See original GitHub issueSteps to reproduce
- Change id field as per bellow code in users.model.js
const DataTypes = Sequelize.DataTypes;
module.exports = function(app) {
const sequelizeClient = app.get("sequelizeClient");
const users = sequelizeClient.define(
"user_system",
{
uid: {
type: DataTypes.INTEGER(10).UNSIGNED,
allowNull: false,
primaryKey: true,
autoIncrement: true
},
userid: {
type: DataTypes.STRING(20),
allowNull: false,
defaultValue: "",
unique: true
},
// ...
- Using postman, call this url using get with proper authentication
http://localhost:3030/users/8
Expected behavior
Should return the user data but it give me error
Actual behavior
The GET request give me bellow error
"name": "NotFound",
"message": "No record found for id '8'",
"code": 404,
"className": "not-found",
"data": {
"name": "SequelizeDatabaseError",
"parent": {
"code": "ER_BAD_FIELD_ERROR",
"errno": 1054,
"sqlState": "42S22",
"sqlMessage": "Unknown column 'user_system.id' in 'where clause'",
"sql": "SELECT `uid`, `userid`, `password`, `name`, `icno`, `position`, `email`, `mobile`, `phone`, `fax`, `address`, `employee_id`, `dtcreate`, `dtlastin`, `dtmodified`, `remarks`, `img_filename`, `race`, `sex`, `utype_id`, `ulevel_id`, `ucommunity_id`, `areajkp_id`, `communities`, `areas`, `active` FROM `user_system` AS `user_system` WHERE `user_system`.`id` = '8';"
},
"original": {
"code": "ER_BAD_FIELD_ERROR",
"errno": 1054,
"sqlState": "42S22",
"sqlMessage": "Unknown column 'user_system.id' in 'where clause'",
"sql": "SELECT `uid`, `userid`, `password`, `name`, `icno`, `position`, `email`, `mobile`, `phone`, `fax`, `address`, `employee_id`, `dtcreate`, `dtlastin`, `dtmodified`, `remarks`, `img_filename`, `race`, `sex`, `utype_id`, `ulevel_id`, `ucommunity_id`, `areajkp_id`, `communities`, `areas`, `active` FROM `user_system` AS `user_system` WHERE `user_system`.`id` = '8';"
},
"sql": "SELECT `uid`, `userid`, `password`, `name`, `icno`, `position`, `email`, `mobile`, `phone`, `fax`, `address`, `employee_id`, `dtcreate`, `dtlastin`, `dtmodified`, `remarks`, `img_filename`, `race`, `sex`, `utype_id`, `ulevel_id`, `ucommunity_id`, `areajkp_id`, `communities`, `areas`, `active` FROM `user_system` AS `user_system` WHERE `user_system`.`id` = '8';"
},
"errors": {}
}```
### System configuration
Tell us about the applicable parts of your setup.
**Module versions** (especially the part that's not working):
Feathers-sequelize "version": "3.1.0"
**NodeJS version**:
v8.9.4
**Operating System**:
Windows10 Home
**Browser Version**:
Chrome Version 64.0.3282.140 (Official Build) (32-bit)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Custom field with id <id> doesn't exist
Hi, For context, I'm trying to implement a searchable custom field in Jira. My understanding is that I need to update the custom...
Read more >Custom id field in Django model - python - Stack Overflow
I want to use custom id field in my model and i know about uuid module. The problem is i don't know where...
Read more >Custom field with ID 0 is not on given object - Developers & API
Trying to create a simple task with custom fields, but getting the error message above. The ID im specifiying is from the get...
Read more >Query for Id of a Custom Field - Salesforce Developers
I'm not wanting the ID for a record in the object I want the Id for the actual field.
Read more >Why i can't get custom fields value or post ID via Ajax?
Because they're 2 different requests, and the post doesn't carry over to the AJAX request from the initial load. Nothing is remembered ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You also have to add the
id
service option in yourusers.service.js
.Thanks and you are right about that too. Today I get the same problem for other services as well!
Thanks again and closing this question.