Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: props[propIndex].split is not a function #154

Open
xerxesb opened this issue Apr 18, 2017 · 10 comments
Open

TypeError: props[propIndex].split is not a function #154

xerxesb opened this issue Apr 18, 2017 · 10 comments

Comments

@xerxesb
Copy link

xerxesb commented Apr 18, 2017

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.

@ghost
Copy link

ghost commented Jul 4, 2017

did you fix that? i am stuck with the same problem...

@hExPY
Copy link

hExPY commented Aug 24, 2017

Same problem here. Anyone know how to fix?

@nanthanwa
Copy link

Same problem :(

@droidmanspace
Copy link

same problem !!!!!!!!!!!!!!!

@ivan-mezentsev
Copy link

same problem !!!!!!!!!! ! ! ! ! ! !!!!!

@mattdawson
Copy link

mattdawson commented May 13, 2018

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.

@ghost
Copy link

ghost commented Oct 8, 2019

@mattdawson thanks; i had added Array.prototype.random() and turns out for (var x in ['a']) included random.

@maroodb
Copy link

maroodb commented Nov 4, 2019

@mattdawson but why node-rest-client depends on what user do with Array or Object prototype ?

@ghost
Copy link

ghost commented Nov 4, 2019

@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
});

@maroodb
Copy link

maroodb commented Nov 5, 2019

@ledlamp I think to avoid those type of problems when we develop a library we shouldn't depends on user manipulations, thank's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants