Results 1 to 3 of 3

Thread: "Uncaught TypeError: Cannot call method 'indexOf' of null" with testing/prod build

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    32
    Answers
    4

    Default Answered: "Uncaught TypeError: Cannot call method 'indexOf' of null" with testing/prod build

    My app works fine in development, and builds fine using 'sencha app build testing' (or production). The problem is when i upload the app to our web server I get the above error. It seems to be on 'Ext.String.urlAppend' and that URL passed into that function appears to be null. I googled it a wee bit, and noticed a few people got this error when their store's proxies didn't have a URL set. A few of mine didn't (they get set later dynamically from the controller), but even if I set them to something arbitrary, I still get the same error.

    You can see the app at https://m.stir.ac.uk

    Code:
    • [COLOR=red !important]Uncaught TypeError: Cannot call method 'indexOf' of null app.js:1046[/COLOR]
      • [COLOR=red !important]Ext.String.urlAppend[/COLOR]app.js:1046
      • [COLOR=red !important]Ext.define.buildUrl[/COLOR]app.js:50181
      • [COLOR=red !important]Base.implement.callParent[/COLOR]app.js:4460
      • [COLOR=red !important]Ext.define.buildUrl[/COLOR]app.js:57625
      • [COLOR=red !important]Ext.define.buildRequest[/COLOR]app.js:49982
      • [COLOR=red !important]Ext.define.doRequest[/COLOR]app.js:57560
      • [COLOR=red !important]Ext.define.read[/COLOR]app.js:49939
      • [COLOR=red !important]Ext.define.load[/COLOR]app.js:56026
      • [COLOR=red !important]Ext.define.updateAutoLoad[/COLOR]

    EDIT-working back through the stack in Chrome Dev Tools, the undefined URL appears to be for a store that definitely 100% has a URL, which is very strange. When I remove the reference to that particular store/controller/view, the app loads fine, so it's just that particular store that the URL is undefined in the testing/production build. Any ideas? It uses the google feed api to convert to json from RSS, but I use the same api for a few other stores without a problem? JSONlint says the feed is valid too.

    Code:
    Ext.define('mStir.store.isNewsList', {
        extend:  Ext.data.Store ,
        xtype:'newslist',
                                                                 
        config: {
            model: 'mStir.model.isNewsItem',
            autoLoad: true,
            url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=15&q=http://blogs.stir.ac.uk/isnews/?feed=rss2',
            proxy: {
            type: 'jsonp',
            reader: {
                type: 'json',
                rootProperty: 'responseData.feed.entries'
                }
            
            }
            }
    
    
    });


    Thanks! I'm so close to getting the app finished!

  2. Found the problem. Thought it was a typo I've just been missing, but it appears the build process moves the proxy URL from within the proxy brackets, to above it. Weird. Anyway, just need to remember to move it back in, after I've built the app!

    So pre-building, it looks like this:

    Code:
    Ext.define('mStir.store.isNewsList', {
        extend:  Ext.data.Store ,
        xtype:'newslist',
                                                                 
        config: {
            model: 'mStir.model.isNewsItem',
            autoLoad: true,
            proxy: {
            url: 'https://ajax.googleapis.com/ajax/services/feed/loadv=1.0&num=10&q=http://blogs.stir.ac.uk/isnews/?feed=rss2',
            type: 'jsonp',
            reader: {
                type: 'json',
                rootProperty: 'responseData.feed.entries'
                }
            
            }
            }
    
    });
    And afterwards, it looks like this:

    Code:
    Ext.define('mStir.store.isNewsList', {
    	extend:  Ext.data.Store ,
    	xtype:'newslist',
    	                                                         
    	config: {
    		model: 'mStir.model.isNewsItem',
    		autoLoad: true,
            url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=15&q=http://blogs.stir.ac.uk/isnews/?feed=rss2',
    		proxy: {
    		type: 'jsonp',
            reader: {
                type: 'json',
                rootProperty: 'responseData.feed.entries'
                }
    		
    		}
    		}
    
    
    });

  3. #2
    Sencha User
    Join Date
    Mar 2013
    Posts
    32
    Answers
    4

    Default

    Found the problem. Thought it was a typo I've just been missing, but it appears the build process moves the proxy URL from within the proxy brackets, to above it. Weird. Anyway, just need to remember to move it back in, after I've built the app!

    So pre-building, it looks like this:

    Code:
    Ext.define('mStir.store.isNewsList', {
        extend:  Ext.data.Store ,
        xtype:'newslist',
                                                                 
        config: {
            model: 'mStir.model.isNewsItem',
            autoLoad: true,
            proxy: {
            url: 'https://ajax.googleapis.com/ajax/services/feed/loadv=1.0&num=10&q=http://blogs.stir.ac.uk/isnews/?feed=rss2',
            type: 'jsonp',
            reader: {
                type: 'json',
                rootProperty: 'responseData.feed.entries'
                }
            
            }
            }
    
    });
    And afterwards, it looks like this:

    Code:
    Ext.define('mStir.store.isNewsList', {
    	extend:  Ext.data.Store ,
    	xtype:'newslist',
    	                                                         
    	config: {
    		model: 'mStir.model.isNewsItem',
    		autoLoad: true,
            url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=15&q=http://blogs.stir.ac.uk/isnews/?feed=rss2',
    		proxy: {
    		type: 'jsonp',
            reader: {
                type: 'json',
                rootProperty: 'responseData.feed.entries'
                }
    		
    		}
    		}
    
    
    });

  4. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    32
    Answers
    4

    Default

    Incidentally, does anyone know why that happens? I've even tried moving the URL down to below the 'type' attribute, but it still just bounces back to being above the proxy setting once the app is built? Not such a big deal to move when creating testing, but more of a pain to locate in production.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •