Recently I meet with an annoying Javascript error “undefined is not a function” during my Fiori development. After debugging the framework code for several hours
, I finally find a more efficient way to find the exact source code which causes the trouble. I would like to share this small tip with you and hope it could help.
Issue: When I am doing test on my application on a local tomcat, I could only see an empty screen.
For sure there must be some Javascript error occurred.
Conclusion
Although this error is raised in UI framework js file, it is however an absolute application issue: the url of OData is defined in Configuration.js file by application as metadata, and UI framework in the runtime will ask for it by calling some callback functions defined by application and then consume it. Framework will assume always a String for OData service url returned by application.
After the following fix is done on application, the issue is fixed.
Any other alternative solution?
Later on I find another approach to find the position ( line 154, column 36 ) even without debugging.
I test my app with Firefox. To my surprise, it could directly display more detail about this error compared with Chrome: “j.serviceUrl.indexOf is not a function”.