arb / celebrate

A joi validation middleware for Express.
MIT License
1.33k stars 66 forks source link

Validating but getting error: stepValidate.then.catch #186

Closed BertBR closed 4 years ago

BertBR commented 4 years ago

My joi schema looks like this:

return celebrate(
      {
      body: Joi.object().keys(
          {
              title: Joi.string().max(255).required(),
          }
       )

The validation is working but i'm getting something "more" about stepValidate.

The issue I am having with celebrate is:

I'm getting this return as response:

>  Error: "title" is required
>      at stepValidate.then.catch (/Users/bert/Documents/Projects/NodeJS/myProject/firebase/functions/node_modules/celebrate/lib/index.js:104:13)
>      at process._tickCallback (internal/process/next_tick.js:68:7)
BertBR commented 4 years ago

Solved with router.use(errors());