PDA

View Full Version : application fails on deployment to production server



Forza Bo
17 Dec 2012, 9:07 AM
I am building an application based on the structure of the MVC tutorial found here (http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-1). The app runs fine from my local machine, but when I upload it to my web server, I get a somewhat baffling error:

TypeError: 'undefined' is not an object (evaluating 'me.model.getProxy')

I understand that the error is saying that the resource doesn't exist, but I don't understand why.

This error persists, even if I remove all the actual calls to load any stores.

I am uploading all the files 100% exactly as they are found in my development folder. Permissions are not an issue.

It would seem to me that the underlying cause is some kind of race condition -- something isn't available yet when the app starts running from the remote server -- but what or why isn't clear at all to me.

I tried wrapping the application creator in an Ext.Loader.onReady -- this made no difference:


Ext.Loader.onReady(function(){ Ext.application({
name: 'Foobar',
autoCreateViewport: true,
models: [
'Egu','EguProto','Result,'//, 'PlanInstructions', Results, PowerGrid
],
stores: [
'Egus','EguProtos','GenResults','Co2Results','So2Results','NoxResults','HgResults'//, 'Instructions', 'Results'
],
controllers: [
'Egu','Map', 'Instructions'//'UserSession', 'PlanEditor', ResultDisplay, YearControl
],
launch: function() {
console.log("application launch!");
},
});
});

skirtle
18 Dec 2012, 3:53 AM
Try following the stacktrace for the error, it'll tell you which of your classes is having the problem. If you can't figure out what it means then try posting it here, see whether anyone else can understand it. You'll need to let us know exactly which ExtJS version you're using so that we can interpret the line numbers.

Forza Bo
18 Dec 2012, 12:00 PM
Thank you very much for your response!

I am using Ext JS 4.1.1. My application is using the build ext-debug.js

The error is thrown at line 341 of AbstractStore.js

When I pause the script in Safari 6.0 after the exception is thrown, there is only one function in the call stack, it is :

garbageCollect() (line 14755, ext-debug.js)


-- that seems like a red herring to me.


FF 14.01(firebug) & Google Chrome (v.23.0.1271.101) show nothing in the call stack.


Thanks again in advance for any help you can give me!!!

Forza Bo
18 Dec 2012, 1:45 PM
Hmmm. Interesting, I didn't change anything in the code, but the Safari 6.0 debugger is a mysterious beast. Selecting "All Exceptions" seems to give more promising clues. Anyway, here is a screenshot from the debugger showing the stack trace and the line that is throwing the exception:

40871

skirtle
18 Dec 2012, 3:57 PM
A few thoughts...

To get the stacktrace in Chrome you need to make sure you open the dev tools before you launch the app. If you open the dev tools too late then you'll not get a stacktrace, just the error message.

Are you sure it isn't logging any warnings to the console? That section of code is full of logging to try to catch common problems.

To debug this error, dig into the store that is being created when it blows up. Inspect the local variable me and try to figure out which store it is that's having the problem. The problem seems to be with either the proxy or the model on that store. At a guess the relevant file isn't being loaded in time and you may need to add a requires block to the store's definition.

Forza Bo
2 Jan 2013, 9:48 AM
To get the stacktrace in Chrome you need to make sure you open the dev tools before you launch the app. If you open the dev tools too late then you'll not get a stacktrace, just the error message.

Are you sure it isn't logging any warnings to the console? That section of code is full of logging to try to catch common problems.

First of all, thank you very much for your response. I have enabled the dev tools before loading the app, seriously, there is nothing in the call stack.

You can try it yourself:

http://whateverdevelops.com/juicebox2

You'll have to skip over the debugger breakpoint in the app class. But then it will hang on the line I mentioned above, with nothing in the call stack. Or maybe I am being a blockhead...

Meanwhile I will see if I can figure out what needs to be required, if anything, that I am missing...

Forza Bo
2 Jan 2013, 10:51 AM
Skirtle: Thank you for the ideas.

By putting a breakpoint directly before where it is hanging, I can examine me -- the problem seems to be that the model is undefined. Hmmm.

In the class that defines this store, it quite explicitly requires the model:

store:


Ext.define('Juicebox.store.Egus', { extend: 'Ext.data.Store',
requires: 'Juicebox.model.Egu',
model: 'Juicebox.model.Egu'
});

model:


Ext.define('Juicebox.model.Egu', { extend: 'Ext.data.Model',
fields: ['id', 'name', 'respondant','description','address',
{name: 'mw', type: 'float'},
{name: 'co2', type: 'float'},
{name: 'so2', type: 'float'},
{name: 'nox', type: 'float'},
{name: 'hg', type: 'float'},
{name: 'fpeak', type: 'float'},
'fuel', 'lat', 'lon', 'fueltype','notes'], // keep it simple for now

proxy: {
type: 'ajax',
url: './data/egus.json',
reader: {
type: 'json',
root: 'data'
}
}
});

The console shows that the scripts in question are loaded. (In fact it seems, more than once)

I wonder if this is some kind of namespace problem?

Forza Bo
2 Jan 2013, 10:54 AM
screenshot of debugger display showing the vitals per above

41043

Forza Bo
2 Jan 2013, 11:27 AM
DUH.

Answer: file names on the server (Linux) are cAseSensitive. On the local machine (OSX) ... they ain't.