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.

TypeError => 'validate' of undefined (prototype leakage)

See original GitHub issue

Hi all.

Here is a part of my code:

var importDb = function() {
  sql.connect(connectionString).then(function() {
    console.log('connected');   ///////////////////////////////////// UNTIL HERE IS OK
    var query = 'SELECT TOP 10 * FROM ' + mRecord.view_path + ';'; // I'M SURE QUERY IS OK
    console.log('starting, with query: ' + query);
    var request = new sql.Request();
    request.query(query).then(function(recordset) {
      console.log('data successfully retrieved');  ///////////////// NEVER GETS EXECUTED
    }).catch(function(err) {
      console.log(err);
    });
  });
}

OK, to be honest, when I create a completely new project with this snippet, everything works perfectly but in my development project, the line where is .then(recordset) is throwing the error:

[TypeError: Cannot read property ‘validate’ of undefined]

Do you have a hint why? If you need more info, feel free to ask.

Node versions (nvm): 5.1.0 5.3.0 5.5.0

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:22

github_iconTop GitHub Comments

1reaction
josealexandrecommented, Jul 24, 2019

Applying the changes from #879 into my project worked for me

1reaction
johndeveducommented, Sep 12, 2018

I’m not able to reproduce the issue. The error you get is because of invalid type of an input parameter. It’s happening on this line. But the request you’re creating in your sample has no parameters. Are you sure you’re getting this error with exactly this sample code?

This answer was the issue in my case. My teammate was using TYPES.NvarChar instead of TYPES.NVarChar

BTW, the sample code link is no longer pointing to the right line of code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'validate' of undefined
Declare the method as arrow function. This way it will be the instance method but not on the prototype so this will refer...
Read more >
The 10 Most Common JavaScript Issues Developers Face
Uncaught TypeError: undefined is not a function ... Memory leaks are almost inevitable JavaScript issues if you're not consciously coding to avoid them....
Read more >
Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >
CoffeeScript
Note though that unlike with the existential operator, the default is only applied with the value is missing or undefined —passing null will...
Read more >
Adding Instance Properties - Vue.js
In case you're not aware, methods added to a prototype in JavaScript gain the context of ... Uncaught TypeError: Cannot read property 'split'...
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