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

Refresh Fails after update (EmptyResponse- NotFoundError) #2091

Open
ronaksv opened this issue Nov 11, 2020 · 0 comments
Open

Refresh Fails after update (EmptyResponse- NotFoundError) #2091

ronaksv opened this issue Nov 11, 2020 · 0 comments

Comments

@ronaksv
Copy link

ronaksv commented Nov 11, 2020

Introduction

Update fails when 'autoRefresh' true, but succeeds when false.
Below code was working in 0.14.2, but not in 1.2.0

Issue Description

I have a query where I need to update a number of rows based on a condition using 'in' clause. This is what I have written

data = {is_approved: 1, updated_at: new Date()};
User.where('id', 'in', reqData.user_ids)
    .where('role_id',reqData.role_id)
    .save(
            data,
            { method: 'update', require: true, transacting: t, debug: true }
        )
    .then((data) => {
        wCb(null, data);
    })
    .catch((err) => {
        return reject(err);
    });

Screenshot 2020-11-11 at 11 30 47

The above query expands properly and updates the database (when autoRefresh=false) , but when it executes refresh and tries to fetch the updated record, it fails with below error

Screenshot 2020-11-11 at 11 31 11

The above statement fails and gives error of "EmptyResponse"

The reason is when it tries to do "_doFetch" after update, it does not find any record.
The below code/ss is from node_modules/bookshelf/lib/model.js

Screenshot 2020-11-11 at 11 24 29

Expected behaviour

It should autorefresh properly using all the attributes. (This was working in 0.14.2, but not in 1.2.0)

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

1 participant