Error in server app but not in local testing

When running from a server, I’m getting the error; “Could not execute returned javascript: window.GSjQuery is not a function”. This is followed by hundreds more lines of messages. I am using some graffitsuite objects, so I don’t know if this is a xojo error or graffitisuite error.

This error does not show up when running locally. Is there any way to tell what is causing this in the server app? Is there any way generally to debug a server app, other than putting Msgbox notices all around?

Kevin Clark

Make sure any control manipulating you do is done in the Shown() event. Javascript errors in the browser almost always represent a situation where you are trying to manipulate a control that has not been created yet in the browser. This is caused by using the Open() event like you would in a desktop app.

Developing locally there is no latency so the control is usually shown even by the time the Open() event fires so the problem does not produce itself.

To test latency locally you can use this Java tool called Sloppy: http://www.dallaway.com/sloppy/

Something really weird is going on with this particular app. The app takes about 40 seconds before it says “Launching” and then it takes another 40 seconds before the first screen comes up. I’ve got other apps on the same server that seem to average about 6 to 8 seconds before loading the first page.

I’ve checked the session and there’s nothing unusual there, it’s basically just opening the postgres table.

Regarding the eventual error, I’ve moved everything out of the Open events and into the Shown events. Maybe it’s simply the extreme delay in loading which is causing the problem. But I don’t know what’s causing the extremely slow loading time. It’s running as a CGI and I’ve tried both 32 bit and 64 bit. It’s doing the automatic port choosing.

My guess is that the jquery lib is required and that out on the internet it just takes longer to get to the browser than it does locally.

Moving code to the Shown events will get you part way there, but a better solution is for the control author to prevent these calls from being made until the jquery library gets to the page.

Did you find a solution to the problem?

I have the same issue using GraffittiSuite. Error message on the Linux-host, but it runs OK under development on the Mac.

I have stripped down the app, so it’s not more than 10 lines of code and nothing in the Open event, but it’s still crashing.

Any ideas?

Thank you for posting this. Unfortunately, it does not work anymore with Chrome. Since version 42, it won’t let Java plugin run :frowning:

[quote=319473:@Greg O’Lone]My guess is that the jquery lib is required and that out on the internet it just takes longer to get to the browser than it does locally.

Moving code to the Shown events will get you part way there, but a better solution is for the control author to prevent these calls from being made until the jquery library gets to the page.[/quote]

It seems possible to install JQuery locally, which should speed it up considerably Installing jQuery? - Stack Overflow

The reason for my problem with GraffittiSuite was differences in how a standalone vs CGI web app is deployed. When you deploy as a CGI you need a link in the session object to the location of the java scripts. Now it works.

Note to self: Read the instructions next time :slight_smile: