Page 1 of 1
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Mon Apr 27, 2015 8:17 pm
by Todd Penny
Need help tracking down the cause of this error in the console:
'TypeError: value.replace is not a function'
I am invoking a REST service with a set of parameters which all appear to be valid in the Local Storage Resources where they are being referenced. The service works when tested. Some values are required even if the value is "" empty string, perhaps they are getting skipped?
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Tue Apr 28, 2015 6:03 am
by Serhii Kulibaba
Hello Todd,
Does that storage variable have all parameters which are used in mapping? It should be filled before service execution.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Tue Apr 28, 2015 2:36 pm
by Todd Penny
I believe that it does and have checked the mappings and ensured there are default values set to. I have looked at the Local Storage Resources in the console and see the right values there too. Given all that I do believe that this is a problem with something being missed or mapped incorrectly, it's just very hard to find which one.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Thu Apr 30, 2015 1:57 am
by Yurii Orishchuk
Hi Todd,
It's hard to say what is wrong in your case. Cause of there is a lot of variants.
Please give us your app public link and describe steps how to reproduce this issue in your app.
Regards.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Thu Apr 30, 2015 3:19 pm
by Todd Penny
Hello Yuri, thanks for getting back to me. It's true there any many variables being passed with different types and I think that's why it's harder to debug. My other services are all working. Here are the step.
1) Signin (using default)
2) click Search Button (use default)
3) click Update
4) click Save
5) view console to see error
project URL: http://appery.io/app/mobile-frame?src...
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Fri May 01, 2015 2:42 am
by Yurii Orishchuk
Hi Todd,
As i can see you have a lot of links for the "restservice9" service datasource.
I guess the culprit is one of these links.
Please try to find this link in way of deleting links one by one until problem will disappear.
Regards.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Fri May 01, 2015 11:09 am
by Todd Penny
You are correct and I have tried this as far as I can. Unfortunately most of the links are required so it's not as easy as it looks.
If I could just set a break point and see the full REST URL POST string I'm sure I could easily spot the error as I can send these requests manually.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Mon May 04, 2015 1:49 am
by Yurii Orishchuk
Hi Todd,
Unfortunatly there is no way to handle where(at what actual parameter) you have this problem. I've checked it before.
So only way is it delete links one by one. You can also clone this page to find a culprit parameter in this service. I guess the problem in received value type.
I can help further but i need to know what parameter causes this problem.
Regards.
How to debug cause of 'TypeError: value.replace is not a function' error message in console for REST service call
Posted: Mon May 04, 2015 2:59 am
by Todd Penny
I have it working now. I had to create a test harness and invoke the restservice method from JS manually so I could inspect each of the parms and find the problem.