Cameron Johnston
Posts: 0
Joined: Mon Jun 17, 2013 3:47 pm

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

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

Cameron Johnston
Posts: 0
Joined: Mon Jun 17, 2013 3:47 pm

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

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Cameron Johnston
Posts: 0
Joined: Mon Jun 17, 2013 3:47 pm

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Cameron Johnston
Posts: 0
Joined: Mon Jun 17, 2013 3:47 pm

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

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Return to “Issues”