Closed Navino16 closed 5 years ago
https://travis-ci.org/arb/celebrate/jobs/544773858 shows all the tests passed in node 10.16.0. I'm going to need more information I guess.
It looks like you might be passing in incorrect options into celebrate
from the stack trace.
This what I use:
export const postUser = { body: Joi.object().keys({ username: Joi.string().alphanum().min(4).max(16).required(), email: Joi.string().email().required(), password: Joi.string().regex(new RegExp(reg)).required(), parentEmail: Joi.string().email().allow(null), bio: Joi.string().min(1).allow(null), picture: Joi.string().min(1).max(255).uri().allow(null), banner: Joi.string().min(1).max(255).uri().allow(null), }), };
router.route("/register") .post( celebrate(postUser.body), AuthController.postRegister, );
Putting this here may thinking me that I'm doing wrong and that I have to send to celebrate postUser
and not postUser.body
. Right ?
Looks like it, yes. Try passing in postUser
.
I will definitly look at this tomorrow. Keep you in touch with that.
It was that. Thanks for your help.
Hello, I can't use Celebrate due to some AssertionError.
node
version - 10.16.0celebrate
version - celebrate@10.0.1joi
version (vianpm ls --depth=0 | grep joi
) - @hapi/joi@15.0.3Explain the problem here When I wan't to run my app, I got this:
AssertionError [ERR_ASSERTION]: ifError got unwanted exception: "isJoi" is not allowed. "_currentJoi" is not allowed. "_type" is not allowed. "_settings" is not allowed. "_baseType" is not allowed. "_valids" is not allowed. "_invalids" is not allowed. "_tests" is not allowed. "_refs" is not allowed. "_flags" is not allowed. "_description" is not allowed. "_unit" is not allowed. "_notes" is not allowed. "_tags" is not allowed. "_examples" is not allowed. "_meta" is not allowed. "_inner" is not allowed at Object.celebrate (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\node_modules\celebrate\lib\index.js:78:10) at Object.exports.process (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\node_modules\@hapi\joi\lib\errors.js:202:19) at internals.Object._validateWithOptions (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\node_modules\@hapi\joi\lib\types\any\index.js:762:31) at module.exports.internals.Any.root.validate (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\node_modules\@hapi\joi\lib\index.js:145:23) at Object.celebrate (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\node_modules\celebrate\lib\index.js:77:20) at Object.<anonymous> (C:\Users\njaunet\Documents\NPU\Net\ScheduleManager\schedulemanagerapijs\build\Routes\AuthRoutes.js:13:23) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3)
If you want more information, I can provide them. Thanks for your help