# TypeError: Cannot read property 'validate' of undefined?

**URL:** <https://forum.codewithmosh.com/t/typeerror-cannot-read-property-validate-of-undefined/6703>\
**Category:** React\
**Created:** [August 10, 2021, 6:52am UTC](https://forum.codewithmosh.com/t/typeerror-cannot-read-property-validate-of-undefined/6703 "2021-08-10T06:52:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![A100D-JS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/a100d-js/32/8_2.png) [@A100D-JS](https://forum.codewithmosh.com/u/A100D-JS)\
**Post date:** [December 16, 2021, 11:33pm UTC](https://forum.codewithmosh.com/t/typeerror-cannot-read-property-validate-of-undefined/6703/6 "2021-12-16T23:33:47Z")

</div>

Hi,

If you’re using more up-to-date version of **Joi** package, the syntax has been changed so it might be the reason that you’re getting this error:

> [@Joi version 17+](https://forum.codewithmosh.com/t/joi-version-17/992/2):
>
> Hi, // Joi Version -\> 17 app.post("/api/courses", (req, res) =\> { const name = { name: req.body.name }; const schema = Joi.object({ name: Joi.string().min(3).required() }); const result = schema.validate(name); if (result.error) { res.status(400).send(result.error.details[0].message); } And the rest would be the same

---

_[View the full topic](https://forum.codewithmosh.com/t/typeerror-cannot-read-property-validate-of-undefined/6703)._
