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.

patch doesn't throw correct object

See original GitHub issue

Using auth for facebook generated by feathers cli, patch function fails , the issue is with the data parameter in service.js on line 164.

For more verbose explanation

  feathers-authentication:oauth2 Updating user: 57b71962784bec9f311e4462 +821ms
  feathers:rest Error in REST handler: `Invalid atomic update value for $__original_remo
ve. Expected an object, received function` +11ms
  feathers-authentication:middleware An authentication error occurred. +2ms Error: Inval
id atomic update value for $__original_remove. Expected an object, received function
    at Query._castUpdate (/home/shriyans/Projects/test-app/node_modules/mongoose/lib/que
ry.js:2378:13)
    at Query.update (/home/shriyans/Projects/test-app/node_modules/mongoose/lib/query.js
:2161:22)
    at Function.update (/home/shriyans/Projects/test-app/node_modules/mongoose/lib/model
.js:2056:13)
    at Object.patch (/home/shriyans/Projects/test-app/node_modules/feathers-mongoose/lib
/service.js:255:27)
  at /home/shriyans/Projects/test-app/node_modules/feathers-hooks/lib/hooks.js:74:31
    at new Promise (/home/shriyans/Projects/test-app/node_modules/core-js/modules/es6.pr
omise.js:191:7)
    at /home/shriyans/Projects/test-app/node_modules/feathers-hooks/lib/hooks.js:58:16
    at run (/home/shriyans/Projects/test-app/node_modules/core-js/modules/es6.promise.js:87:22)
    at /home/shriyans/Projects/test-app/node_modules/core-js/modules/es6.promise.js:100:28
    at flush (/home/shriyans/Projects/test-app/node_modules/core-js/modules/_microtask.j
s:18:9)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
shrynxcommented, Sep 14, 2016

@ekryski @daffl I also didn’t know well about how mongoose works (I still don’t know , Db is my weakest tool) , but if lean gives us performance and also solves core issues , then i think it should be part of cli tool (as it would help beginers like me). I have been busy for a long while but next week onward i’ll try to figure out the core issue. Also, i just want to say , you guys are REALLY doing an awesome job. I have been using feathers for a project in my company for a while. And it is AWESOME !!! Before starting feathers, i had little to no clue over service based architecture and discovered feathers because meteor wasn’t giving me enough freedom ( too much “magic” happening , if i put it nicely). Thanks a lot.

1reaction
laxgoalie392commented, Sep 9, 2016

I’ve had this issue as well for a bit now.

I tried following @madmantalking’s advice but: fix 1: I didn’t want to be updating imported libraries. fix 2: I tried googling how to set lean globally and couldn’t get it to work.

As I’m just playing around with the framework right now I found a not so bad approach to at least continue testing it.

In the generated code file src/services/user/index.js I added lean: true to the options passed into the service:

  const options = {
    Model: user,
    paginate: {
      default: 5,
      max: 25
    },
    lean: true,
  };

  // Initialize our service with any options it requires
  app.use('/users', service(options));

I’m not even sure what the lean option does but at least I can play around with featherjs more now! Maybe that will help someone play around as well until a fix comes out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why python mock patch doesn't work? - Stack Overflow
I have two files. spike.py class T1(object): ...
Read more >
Power Apps Patch Function Error Handling - Matthew Devaney
It is important to perform patch function error handling In Power Apps any time you are updating records in a datasource.
Read more >
dekenception: check missing objects from patch and suggest ...
client-side: last night I created a [findbrokenobjects] object in the iemguts library that searches all top-level patches recursively for ...
Read more >
unittest.mock — mock object library — Python 3.11.1 ...
The patch() decorator / context manager makes it easy to mock classes or objects in a module under test. The object you specify...
Read more >
throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current function will stop (the statements after throw won't be executed) ...
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