Page 1 of 1

Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Tue Jun 25, 2013 11:16 pm
by Cameron Johnston

Hello,

I'm developing a mobile app using the Progress Openedge mobile app builder. In my mobile app I invoke a service upon a page show. When I'm testing the app in my web browser, when the service should be invoked it is not. After looking in my Developer Tools - Console in Google Chrome, I found the message
"TypeError Cannot call method 'subscribe' of type null" appears each time my mobile service should be invoked. I've been searching Google, StackOverflow, etc. for similar cases but it seems articles I find are related only to JavaScript.

Any ideas as to why I'm getting this error and what I can do about it would be great, thanks. Let me know if I can provide any more details.

Cheers,
Cameron


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Tue Jun 25, 2013 11:47 pm
by maxkatz

Let us know if this helps: https://getsatisfaction.com/apperyio/...


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 3:22 pm
by Cameron Johnston

Thanks but I don't think I'm in the same situation. My problem occurs not on a page show, but only when my mobile service should be invoked. It's set to be invoked after the user clicks a radio element.
EDIT: I also checked all 'use full page refresh' buttons in my 'navigate to page' events.
EDIT 2: Based on my findings in the Google Chrome dev tools:
The message in my console is coming from the following JS code: (Read25RBLogs is the name of my mobile service which is not being invoked when it should be).
try {
Read25RBLogs.execute({})
} catch (ex) {
console.log(ex.name + ' ' + ex.message);
hideSpinner();
};

The 'console.log(ex.name + ' ' + ex.message);' line is where the message is coming from. I just have no idea why.


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 4:53 pm
by Maryna Brodina

Hello! Could you clarify is Read25RBLogs - REST service or Generic service?


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 4:56 pm
by Cameron Johnston

REST service I believe. When I created the service I selected JSON and created the services from my JSON file.


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 5:13 pm
by Maryna Brodina

Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 6:17 pm
by Cameron Johnston

It seems I've solved the problem.

I use multiple (currently 4) different JSON files for 4 different mobile services. Before invoking a 'Read' service I forgot that I need to first invoke the corresponding 'JSDO' service. I will definitely remember this in the future!

I've e-mailed my app as a zip file in case you are interested to compare it to future cases. Thanks for your help.


Javascript TypeError: Cannot call method 'subscribe' of type null

Posted: Wed Jun 26, 2013 6:22 pm
by Maryna Brodina

Thank you for update and file you sent. Glad it's working!