View Full Version : [INFOREQ] Wrong model load URL when using ext-all-rtl-debug.js

5 Jul 2015, 7:50 PM
Hi everyone,

So I am currently migrating our application from Ext JS 5 to Ext JS 6 and then I got a problem when I try to login. Our login process calls the load function of one of our data model, so it will send a get request to our backend through our custom Ext JS proxy. The proxy is for building URLs which match our REST service on our backend. The login function doesn't work after I upgraded my application to Ext JS 6 because the URL that the application is calling has changed. The URL should be like:


The parts xxxxx and users are built by our proxy, and the MY_USERNAME is appended by Ext JS.

For some reason, Ext JS 6 has appended the model name after our custom path:


User is the name of the data model.

Then, I tried to remove the line inside the following entry so it will load the Ext JS SDK individually and then everything works fine:

"classic": {
"js": [
// Remove this entry to individually load sources from the framework.
"path": "${framework.dir}/build/ext-all-rtl-debug.js"

I would like to keep the line above so we don't need to load the SDK individually but I couldn't find a way to solve this issue.

5 Jul 2015, 8:24 PM
There's not enough information to be able to move forward here.

What if you step through the code that makes the request (proxy.Server.buildUrl). What do you see as it constructs the url?

5 Jul 2015, 9:15 PM
Thanks for the quick response.

We actually did override the buildUrl function in our custom proxy.

buildUrl: function(request) {
var url = this.callParent(arguments);
url = ...
return url;

We tried to log the url that returns by the callParent function, and we found that the results between using the ext-all-rtl-debug.js and not using it is different. When not using it, it is fine, no model name has been appended. But when using it, the model name has been appended.

5 Jul 2015, 9:49 PM
What happens if you put a break point and step through it til it hits making the request?

6 Jul 2015, 12:23 AM
I cannot see anything special... that model name is already there before it calls buildUrl

6 Jul 2015, 1:16 PM
I'm not really sure I follow. The url gets constructed inside buildUrl, so it should be entirely empty at that point. It passes along the request object, which asks for the url from the request (if specified) or otherwise generates it from what is specified in the proxy.

6 Jul 2015, 7:20 PM
Sorry for the expression. What I was meaning is that the url in the request object has already been appended the model name.

I was stepping through the code that the SDK constructs the proxy object of the model when I call Model.load function, and I found that something is different between using ext-all-rtl-debug.js and not using it:

When the SDK calls the constructProxy function (Ext.data.schema.Schema.constructProxy), it calls getProxy() function to get the proxy template, but the templates are different.

Using ext-all-rtl-debug.js is like this

_proxy: constructor

template: Object

type: "custom-rest"
url: "{prefix}/{entityName}"

Not using it is like this:

_proxy: constructor

template: Object

type: "custom-rest"
url: "{prefix}/"

Any Idea why it is different? :)

7 Jul 2015, 1:59 PM
It's probably a timing issue. I'm assuming you're declaring your own model type with a url at some point?

7 Jul 2015, 5:41 PM
Timing issue? We have an abstract model which is configured to use our proxy and to override the urlPrefix in the schema.

7 Jul 2015, 10:52 PM
Hi evant,

I just check all of our code once again, and I found that we have override the Schema class to remove the entity name by overriding the proxy.url in the config property to match our REST service url. My bad. Sorry about that. So now the problem is that when using ext-all-rtl-debug.js, it doesn't take my override class for the Schema. Here is my code:

Ext.define('XXX.data.schema.Schema', {
override: 'Ext.data.schema.Schema',

config: {
proxy: {
// remove the default entityName from the url
url: '{prefix}/'


8 Jul 2015, 4:25 AM
It's probably just a matter of timing. The proxy is likely created before the override is applied. How are you requiring the override? Is it ever executed when you're not using the source version?

8 Jul 2015, 6:06 PM
For requiring the override, we create a override class in the overrides folder in a package that our app is requiring. The source version you mean without requiring ext-all-rtl-debug.js? Without requiring the ext-all-rtl-debug.js, it is executed. It doesn't execute only when we require it.

8 Jul 2015, 6:16 PM
Ok, so what if you require the override?

Also, this would all probably be resolved if you used Cmd to create a build.

8 Jul 2015, 7:55 PM
We tried to require our override class in different places such as Application.js or our parent Model class but we still have the same issue.

8 Jul 2015, 8:22 PM
At this point I think it;s best you raise a support ticket, there's not really enough information to go on without seeing how you're setting up your code. I don't think there's any bug here, just a misconfiguration or a timing issue in the structure of your app.