TypeError => 'validate' of undefined (prototype leakage)
See original GitHub issueHi 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:
- Created 8 years ago
- Comments:22
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Applying the changes from #879 into my project worked for me
This answer was the issue in my case. My teammate was using
TYPES.NvarCharinstead ofTYPES.NVarCharBTW, the sample code link is no longer pointing to the right line of code.