Comments (4)
Having this exact issue did you ever manage to fix it?
from mean-machine-code.
@mikevarela @peweet Do you guys get any error messages? If so, what are they?
from mean-machine-code.
Here's the error I'm getting. Guessing this is what they're getting as well...
API Requested
(node:535) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
{ ValidationError: User validation failed: password: Path `password` is required., username: Path `username` is required.
at ValidationError.inspect (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/error/validation.js:57:23)
at formatValue (util.js:362:36)
at inspect (util.js:226:10)
at format (util.js:98:24)
at Console.log (console.js:113:24)
at /mnt/c/Web/mean-machine/server.js:54:19
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/model.js:3822:16
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/services/model/applyHooks.js:167:17
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
errors:
{ password:
{ ValidatorError: Path `password` is required.
at ValidatorError (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/error/validator.js:25:11)
at validate (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:758:13)
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:805:11
at Array.forEach (<anonymous>)
at SchemaString.SchemaType.doValidate (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:765:19)
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/document.js:1481:9
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
message: 'Path `password` is required.',
name: 'ValidatorError',
properties: [Object],
kind: 'required',
path: 'password',
value: undefined,
reason: undefined,
'$isValidatorError': true },
username:
{ ValidatorError: Path `username` is required.
at ValidatorError (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/error/validator.js:25:11)
at validate (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:758:13)
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:805:11
at Array.forEach (<anonymous>)
at SchemaString.SchemaType.doValidate (/mnt/c/Web/mean-machine/node_modules/mongoose/lib/schematype.js:765:19)
at /mnt/c/Web/mean-machine/node_modules/mongoose/lib/document.js:1481:9
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
message: 'Path `username` is required.',
name: 'ValidatorError',
properties: [Object],
kind: 'required',
path: 'username',
value: undefined,
reason: undefined,
'$isValidatorError': true } },
_message: 'User validation failed',
name: 'ValidationError' }
POST /api/users?name=test&username=testusername&password=testpassword 200 78.294 ms - 646
from mean-machine-code.
I forget if I managed to fix but this is what I think I did. If you read the error carefully it tells you exactly whats wrong.
'username' & 'password' values are needed.
The code is executing perfectly but fails as actual values are needed.
So quite simply the validation has failed because the computer is too stupid to figure out what to do when it has nothing to work with! :-)
We need to pass in a generic password and user to fill the undefined value. Or write a usecase to handle the null value.
ie a bit of psuedo
IF empty PRINT 'Sorry buddy you have to type something for me to work ENDIF
So find a way to pass user and password values through the command line to see it works at runtime. If that doesn't work manually try put in values directly into the Javascript.
var user = new User(); // create a new instance of the User model user.name = req.body.'Elvis Presley'; // set the users name (comes from the request) user.username = req.body.'ElvisPresley123'; // set the users username (comes from the request) user.password = req.body.'VivaLasVegas'; // set the users password (comes from the request)
from mean-machine-code.
Related Issues (20)
- In User CRM chapter, catchall route in server.js is catching requests for js files in index.html HOT 1
- Cannot find module .app/modules/user HOT 6
- Issue with pg. 132 Routing HOT 6
- CH-17: How do I create a new user without an existing one. No token = no user? HOT 4
- Just a little fix on the login spinner in chapter 17 HOT 1
- 'username not found' in chapter 10 HOT 4
- expiresInMinutes is deprecated HOT 1
- TypeError: Auth.getUser(...).success is not a function HOT 1
- Gulp & Linting JS page 235
- Not working with UI-ROUTER HOT 1
- 17 - User CRM Login HOT 3
- Interceptor not triggered whan comming from /api/whatever
- Cloned the Repository: Ran npm intsall in chapter 17: Still doesn't work HOT 1
- login username on navbar HOT 2
- POST Http Issue
- $http.get and posts
- A bug in authService of the 17-user-crm HOT 1
- angular project issue
- Potential Security Issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mean-machine-code.