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.

authManagement:verifySignup - Method: create: users.find is not a function

See original GitHub issue
  1. The feathers app was initially created used the cli generator.
  2. The auth manager is initialized after all other services.
  3. After the user is created, the verify email is sent.
  4. Clicking the link, the client app calls verifySignupLong(token).
  5. Then on the server, the auth manager verifySignupWithLongToken function is called, which should call the users service, but the I get this error:
authManagement:main service called. action=verifySignupLong +35s
  authManagement:verifySignup verifySignup { verifyToken: 'c18b98c317d6bd5ca99b92a338dc0c' } { verifyToken: 'c18b98c317d6bd5ca99b92a338dc0c' } +54s
info: error: authManagement - Method: create: users.find is not a function
error:  TypeError: users.find is not a function
    at verifySignup (/app/node_modules/feathers-authentication-management/lib/verifySignup.js:38:16)
    at /app/node_modules/feathers-authentication-management/lib/verifySignup.js:18:12
    at process._tickCallback (internal/process/next_tick.js:103:7)

The strange thing is that only if I restart the server the call is done without errors and it recognize the users service.

For now I had to make a workaround:

I cloned this repo and passed the users service in the main auth manager function.

  app.configure(authManagement({
    users: app.service('users'),
    notifier,
  }));

then I changed all repo users service calls to this:

  // const users = options.app.service(options.service);
  const users = options.users;

It worked well, but I want to understand what’s wrong here, I don’t have time to recreate the whole app from ground zero as this has already took me much time and really want to use this package without workarounds.

Lastly, why the context of this feathers app is also wrong tough the auth manager is configured after all other services?

Thanks

    "feathers": "^2.2.0",
    "feathers-authentication": "^1.2.7",
    "feathers-authentication-hooks": "^0.1.4",
    "feathers-authentication-jwt": "^0.3.2",
    "feathers-authentication-local": "^0.4.4",
    "feathers-authentication-management": "^1.0.0",
    "feathers-authentication-oauth2": "^0.2.5",
    "feathers-configuration": "^0.4.1",
    "feathers-errors": "^2.9.2",
    "feathers-hooks": "^2.0.2",
    "feathers-hooks-common": "^3.7.2",
    "feathers-mongoose": "^5.1.2",
    "feathers-rest": "^1.8.0",
    "feathers-socketio": "^2.0.0",

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24

github_iconTop GitHub Comments

1reaction
eddyystopcommented, Jan 5, 2018

I’m on vacation till Jan 10. I can look into these items when I return. I might need @marshallswain 's input.

1reaction
eddyystopcommented, Jan 4, 2018

I will look into this when I return from vacation next Wednesday.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - users.find is not a function nodejs - Stack Overflow
In your login.js module there is no mothod named "find". Try calling a method that exists on it, such as getAllUser.
Read more >
I am getting the error User.create not a function. - Treehouse
When I submit the form I am getting "User.create is not a function". Below is my code.
Read more >
Method is not a function · Issue #5260 · Automattic/mongoose
Hi, I have this method in my model: // Compare password UserSchema.methods.comparePassword = function(candidatePassword){ return bcrypt.
Read more >
User.find is not a function mongoose - Anycodings.com
I'm getting a User.find is not a function anycodings_mongodb error. I believe I've set up everything anycodings_mongodb correctly but apparently ...
Read more >
Node.js User Authentication Guide - LoginRadius Blog
The login function returns status code 400 if the username and password were not provided. You need to find a user with the...
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