question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'validate' of undefined

See original GitHub issue
* getInfo(ctx) {
      const request = ctx.request.body;
      const email = request.email;
      const url = request.filename;
      // const createRule = {
      //   email: {
      //     type: 'email',
      //   }
      // };
      // ctx.validate(createRule);
      const errors = ctx.validator.validate({ email: : 'email' }, request);
      ctx.body = errors || 'ok'
    }

开启验证插件除了在plugin加进来,还要配置什么吗?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dead-horsecommented, Mar 13, 2017
ctx.app.validator.validate

或者你应该

ctx.validate(rule, request); // 会抛出异常
0reactions
treycncommented, Mar 14, 2017

@atian25 尴尬。。解决了

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'validate' of undefined
I am trying to validate my registration form but I'm getting this error and I can't solve it. my form submit button goes...
Read more >
TypeError: Cannot read property 'validate' of undefined? - React
“Cannot read property 'validate' of undefined”? Anyone can help in finding the error. ... Is there any more to that error? For example...
Read more >
TypeError: Cannot read property 'validate' of undefined #2291
I am getting the error TypeError: Cannot read property 'validate' of undefined when running a chai-enzyme test, followed by the warning: ...
Read more >
Cannot read property 'validate' of undefined - Quasar forum
I assumed that it cannot read 'validate' property after all the field was correctly filled. Update : I counter the issue by using...
Read more >
Uncaught TypeError: Cannot read property 'messages' of ...
The error happens when the library `cv.jquery.validate` is added by BigPipe and compressed. I just disabled the library compressing in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found