authManagement:verifySignup - Method: create: users.find is not a function
See original GitHub issue- The feathers app was initially created used the cli generator.
- The auth manager is initialized after all other services.
- After the user is created, the verify email is sent.
- Clicking the link, the client app calls
verifySignupLong(token)
. - 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:
- Created 6 years ago
- Comments:24
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m on vacation till Jan 10. I can look into these items when I return. I might need @marshallswain 's input.
I will look into this when I return from vacation next Wednesday.