Error Cannot read property 'toString' of undefined


Hi All,

I just newbie in mobile develop and nativescript, I just follow and get error when run the app with error message Cannot read property ‘toString’ of undefined in fetch.js –

please advise.

thanks you/.


could you please post some code ??


This is a common JavaScript error, from the error log I suspect you are missing method parameter in your call to fetch module.


Hi All,
thanks for the replies,

the error is come from

viewModel.login = function() {
return fetchModule.fetch(config.apiUrl + “user/” + config.appKey + “/login”, {

I just need to add “appKey” property, and the app can run well, and its like manojdcoder said its common javascript error.

module.exports = {
apiUrl: “”,
appKey: “kid_HyHoT_REf”,
appUserHeader: “Basic a2lkX0h5SG9UX1JFZjo1MTkxMDJlZWFhMzQ0MzMyODFjN2MyODM3MGQ5OTIzMQ”

many thanks.