TypeError: props[propIndex].split is not a function
Hi,
I recently updated from v1.8 to v3.1 to pull a JSON object from a Google Sheets script via a few redirects.
I'm now getting the following error when trying to hit the endpoint. Appreciate any help.
TypeError: props[propIndex].split is not a function at validateProperties (/Users/dev/Documents/src/app/node_modules/node-rest-client/lib/nrc-parser-manager.js:10:39) at Object._private.validate (/Users/dev/Documents/src/app/node_modules/node-rest-client/lib/nrc-parser-manager.js:21:13) at add (/Users/dev/Documents/src/app/node_modules/node-rest-client/lib/nrc-parser-manager.js:34:17) at module.exports (/Users/dev/Documents/src/app/node_modules/node-rest-client/lib/nrc-parser-manager.js:112:15) at new exports.Client (/Users/dev/Documents/src/app/node_modules/node-rest-client/lib/node-rest-client.js:12:53) at Object.getClient (/Users/dev/Documents/src/app/src/js/staff_calendar.js:28:25) at Object.fetchData (/Users/dev/Documents/src/app/src/js/staff_calendar.js:8:35) at staff_leave (/Users/dev/Documents/src/app/routes/index.js:211:9) at callbacks (/Users/dev/Documents/src/app/node_modules/express/lib/router/index.js:164:37) at param (/Users/dev/Documents/src/app/node_modules/express/lib/router/index.js:138:11)
Thanks.
did you fix that? i am stuck with the same problem...
Same problem here. Anyone know how to fix?
Same problem :(
same problem !!!!!!!!!!!!!!!
same problem !!!!!!!!!! ! ! ! ! ! !!!!!
Check your Array.prototype scope, it's probably polluted. e.g. if you hava Array.prototype.something = function() {...} for(var x in ['a']) will return something as the last element, which node-rest-client is not expecting.
@mattdawson thanks; i had added Array.prototype.random() and turns out for (var x in ['a']) included random.
@mattdawson but why node-rest-client depends on what user do with Array or Object prototype ?
@maroodb i think because when you simply assign a new property like Array.prototype.random = ... it creates an enumerable property on all instances of Array, so when you iterate over an array's values with a for...in loop, it includes the inherited property you added. The built-in Array methods are not enumerable, so to properly extend the Array class you have to define it as not-enumerable too:
Object.defineProperty(Array, "random", {
value: function () {...},
enumerable: false
});
@ledlamp I think to avoid those type of problems when we develop a library we shouldn't depends on user manipulations, thank's