Validation Error: schema[parameter].validateAsync is not a function

I’m trying to create an API in express. When I call the same, I’m getting the above error.
I went through the GitHub links below which contain solutions to similar problems but none of them have worked for me. Below is my code which I hope is useful,



Schema: (trip.validator.js)

const Joi = require('joi');

getAllFiltered: {
    query: Joi.object({
      offset: Joi.string(),
      limit: Joi.string(),
      from: Joi.string(),
      to: Joi.string(),
      technicians: Joi.array().items(Joi.string()),
      status: Joi.string(),
      enterprise_id: Joi.string(),
      payment_status: Joi.string().valid('pending', 'invoiced', 'paid')

Route: (trips.route.js)

let router = require('express').Router();
const { validate } = require('express-validation');
const tripValidation = require('../validators/trip.validator');
const tripController = require('../controllers/trip.controller');
const AuthMiddleware = require('../middlewares/auth.middleware')

  (req, res) => {
    tripController.getAllFiltered(req, res)


Kindly help.

8 thoughts on “Validation Error: schema[parameter].validateAsync is not a function”

  1. So, I figured out what was the problem. For some reason, the API endpoint was clashing with another. I just moved the API route from the bottom to the top and that seemed to fix the issue.


Leave a Comment