question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

update not working?

See original GitHub issue

Steps to reproduce

submit http PUT for a resource passing body to be used for update operation

Expected behavior

identified resource should be updated

Actual behavior

PUT returns updated version of object, but no call to database is made leaving persisted resource unchanged

  app:http:steps http-update: method='PUT', url='http://localhost:3000/alerts/3', data={ username: 'user-3', folder: '/folder-3', file: 'file-3', bytes: 4, message: 'message-4' }, headers=undefined +0ms
  feathers:rest REST handler calling `update` from `/alerts/3` +74ms
Executing (default): SELECT `id`, `username`, `folder`, `file`, `bytes`, `message`, `createdAt`, `updatedAt` FROM `Alerts` AS `Alert` WHERE `Alert`.`id` = '3';

PATCH seems to be working correctly…

i stepped thru in a debugger, but wasn’t sure exactly what to look for, if helpful, i can do so again with some guidance as to what to check into…

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that’s not working): feathers: 2.1.3 feathers-rest: 1.7.3 feathers-sequelize: 2.0.0

NodeJS version: 8.1.0

Operating System: osx

fwiw: going against mysql 5.7.18 executing in a cucumber-js test…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
joeblubaughcommented, Aug 4, 2017

@snewell92 the raw option in feathers-sequelize world means that the data object returned by the database adapter is a “plain” JavaScript object. It’s not related to the database query itself. Sequelize works in part by attaching observables to a number of object properties in order to decide whether it needs to execute a database query.

Other feathers hooks seem to have a hard time operating on Sequelize instances - the workaround suggested here is to always use Sequelize instances in the service, which will break many common hooks. A more complete workaround is in the docs here: https://docs.feathersjs.com/api/databases/sequelize.html#working-with-sequelize-model-instances

This involves converting between the Sequelize representation of the data and a “plain” JavaScript Object representation depending on what is needed for the hooks you’re using. So when using Feathers with Sequelize, you have to be very mindful of the data representation required by each hook.

2reactions
marshallswaincommented, Jul 11, 2017

@joeblubaugh no, you maybe missed the first option:

app.use('/people', service({
    Model,
    raw: false
}));

Declaring raw:false in your Model prevents the need to use a hook.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot problems updating Windows
Troubleshoot problems updating Windows · Have issues installing Windows updates? Start here. · Free up some drive space so you can run updates...
Read more >
Windows Update Not Working, Stuck at Checking for ...
Whenever you're having problems with Windows Update, the easiest method you can try is to run the built-in troubleshooter.
Read more >
7 Solutions to Fix Windows 10 Won't Update. #6 Is Fantastic
Windows 10 Won't Update FAQ · Wait or restart the computer. · Free up disk space. · Disable all non-Microsoft programs. · Turn...
Read more >
Windows Update not Working or Loading: Easily Diagnose ...
What to do if Windows Update is not working? · 1. Run the Windows Update troubleshooter · 2. Use System Restore to roll...
Read more >
Windows Update Not working, stuck on Checking for ...
How to fix Windows Update fails to install or will not download? · Run Windows Update Troubleshooter · Manually Reset Windows Update Components...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found