Why is my SQL query not updating user properties other than 'user' in Node.js and MySQL?
The user argument you're printing out isn't an object representing a user, it's an array with a single such element. In addition, the object itself doesn't have the firstName and lastName properties you're trying to use, it has firstname and lastname (notice the lowercase ns). Since they aren't there, they get undefined values
Assuming you intended to pass an array to the function, you should probably iterate over all the users an update each of them. Regarding the properties, if you replace firstName and lastName with firstname and lastname, respectively, you should be OK:
const updateUser = async (users) => {
    users.forEach(user => {
        const {firstname, lastname, email, password, phone, dob, countryid, gender, address, role, id} = user; // Here
        const sql = `UPDATE user set user_firstName = ?, user_lastName = ?, user_email = ?, user_password = ?, user_phoneNumber = ?, user_dob= ?, user_countryId = ?, user_gender = ?, user_address = ?, user_role= ? WHERE client_id = ?`;
        try {
            await db.query(sql, [firstname, lastname, email, password, phone, dob, countryid, gender, address, role, id]); // And here!
            return { message: "records updated successfully." }
        } catch (error) {
            return { message: "Failed to updated" }
        }
    }
});


I have a Service method to update a user from the database:
const updateUser = async (user) => {
    const {firstName, lastName, email, password, phone, dob, countryid, gender, address, role, id} = user;
    const sql = `UPDATE user set user_firstName = ?, user_lastName = ?, user_email = ?, user_password = ?, user_phoneNumber = ?, user_dob= ?, user_countryId = ?, user_gender = ?, user_address = ?, user_role= ? WHERE client_id = ?`;
    try {
        await db.query(sql, [firstName, lastName, email, password, phone, dob, countryid, gender, address, role, id]);
        return { message: "records updated successfully." }
    } catch (error) {
        return { message: "Failed to updated" }
    }
}

whenever I log user alone it can read it, but it's not reading any other properties ( firstName etc...) and getting this error: Bind parameters must not contain undefined. To pass SQL NULL specify JS null.
preview of console.log(user):

my route is working perfectly, the same function has been used before without any issues
