2

I'm trying to debug an issue with my app not stepping forward correctly (worked fine when I left it yesterday) and all it's giving me is the following error in app.js (logged from the console):

Assertion failed: Object(anonymous function) @ app.js:21
header.js:90 view:header@init-summary

And even then only after the following was added to throw a proper error from the RSVP library:

RSVP.on('error', function(reason) {
    console.assert(false, reason);
});

The code-base is absolutely massive and spans almost every language currently in use, from vanilla Javascript to Handlebars to SQL to PHP to etc etc and it's really not clear where to start looking to find out what's causing the error.

Nothing obviously wrong with the network traffic at this stage. Can anyone assist with working out what I actually need to search for? Obviously I'm not going to post the whole code-base but if people need any extra code to help them figure out the problem and can justify why I am more than happy to provide it, assuming I can work out a way to do so without compromising project security.

Line 90 of header.js is:

console.log('view:header@init-summary');

After waiting for a few minutes the system suddenly started transitioning to the next stage of the app but giving the following errors at the proceeding step:

Assertion failed: Object {readyState: 4, responseText: "{"errors":   
[{"status":"404","code":0,"title":"Not Found"}]}", responseJSON: 
Object, status: 404, statusText: "Not Found"}(anonymous function) @ 
app.js:21lib$rsvp$events$$default.trigger @ rsvp.js:245(anonymous 
function) @ rsvp.js:779

And:

Assertion failed: Object {readyState: 4, responseText: "{"errors":
[{"status":"404","code":0,"title":"Not Found"}]}", responseJSON:
Object, status: 404, statusText: "Not Found"}(anonymous function) @ 
app.js:21lib$rsvp$events$$default.trigger @ rsvp.js:245(anonymous 
function) @ rsvp.js:779 jquery.js:9664 PATCH    
http://localhost:4200/data/stub/proposal/PYXA5YVJ60N39T3J1QB8/relationfish    
/selected-fish 404 (Not Found)

After going on lunch and coming back the app began stepping to the third phase with the following error:

Uncaught TypeError: Cannot read property 'get' of undefined

The error points to a generic helper library but does not specify where the helper library is being called from.

Update, now returning the following error instead:

PATCH     http://localhost:4200/data/stub/proposal/P9UZKZYXH92YFDUHGLUK/relationships
/selected-quote 404 (Not Found)send @ jquery.js:9664jQuery.extend.ajax 
@ jquery.js:9215Backbone.RelationalModel.saveRelationship @ json-
api.js:414Marionette.CompositeView.extend.saveApplication @ 
premiums.js:127Marionette.CompositeView.extend.submitStep @ 
premiums.js:118(anonymous function) @ 
backbone.marionette.js:2837triggerEvents @ backbone.js:370triggerApi @ 
backbone.js:357eventsApi @ backbone.js:155Events.trigger @ 
backbone.js:346Marionette.ItemView.extend.select @ 
premium.js:58jQuery.event.dispatch @ jquery.js:4670elemData.handle @ 
jquery.js:4338
jquery.js:9664 XHR finished loading: PATCH   
"http://localhost:4200/fishermen-wires.marionette/stub/proposal/P9UZKZYXH92YFDUHGLUK/relationships/selected-
quote".send @ jquery.js:9664jQuery.extend.ajax @ 
jquery.js:9215Backbone.RelationalModel.saveRelationship @ json-
api.js:414Marionette.CompositeView.extend.saveApplication @ 
premiums.js:127Marionette.CompositeView.extend.submitStep @ 
premiums.js:118(anonymous function) @ 
backbone.marionette.js:2837triggerEvents @ backbone.js:370triggerApi @ 
backbone.js:357eventsApi @ backbone.js:155Events.trigger @ 
backbone.js:346Marionette.ItemView.extend.select @ 
premium.js:58jQuery.event.dispatch @ jquery.js:4670elemData.handle @     
jquery.js:4338

And is instantiating the second view in Chrome, but not in Firefox or Safari. I have hard-reloaded, cache cleaned and removed the cookies in Chrome. There was no cached copy in the other browsers.

I have searched my entire app using the 'Find in Path' function in WebStorm and the jQuery library is not called at any point within the app I am writing, though another code library may be calling it by proxy and it seems as if the library is wanting to be interfaced with in a different way based on the manner in which the intermediary is communicating with it after I pass the data.

Update: now steps through to the step immediately prior to the final completed step (more still to write but that's not the issue at the moment):

Uncaught Error: An "el" #policy-accept-terms must exist in DOM    
Marionette.Region.Marionette.Object.extend._ensureElement   @       
backbone.marionette.js:1231
Marionette.Region.Marionette.Object.extend.show @     
backbone.marionette.js:1089
Marionette.LayoutView.Marionette.ItemView.extend.showChildView  @     
backbone.marionette.js:3109
Marionette.LayoutView.extend.onRender   @   policy.js:79
(anonymous function)    @   backbone.marionette.js:685
Marionette.View.Backbone.View.extend.triggerMethod  @   
backbone.marionette.js:1939
Marionette.ItemView.Marionette.View.extend.render   @    
backbone.marionette.js:2089
Marionette.LayoutView.Marionette.ItemView.extend.render @
backbone.marionette.js:3092
Marionette.Region.Marionette.Object.extend._renderView  @
backbone.marionette.js:1215
Marionette.Region.Marionette.Object.extend.show @
backbone.marionette.js:1145
Marionette.LayoutView.Marionette.ItemView.extend.showChildView  @
backbone.marionette.js:3109
Controller.extend.policy    @   controller.js:117
_.extend.execute    @   backbone.js:1485
(anonymous function)    @   backbone.js:1473
(anonymous function)    @   backbone.js:1756
_.some._.any    @   underscore.js:258
_.extend.loadUrl    @   backbone.js:1754
_.extend.navigate   @   backbone.js:1816
_.extend.navigate   @   backbone.js:1490
Marionette.AppRouter.extend.goToStep    @   router.js:42
Marionette.AppRouter.extend.goToNext    @   router.js:74 
(anonymous function)    @   controller.js:66
triggerEvents   @   backbone.js:368
triggerApi  @   backbone.js:356
eventsApi   @   backbone.js:155
Events.trigger  @   backbone.js:346
(anonymous function)    @   backbone.marionette.js:691
Marionette.View.Backbone.View.extend.triggerMethod  @
backbone.marionette.js:1939
Marionette.ItemView.extend.submitStep   @   add-ons.js:95
jQuery.event.dispatch   @   jquery.js:4670
elemData.handle @   jquery.js:4338

This error seems obvious and easily fixable but I have not made any changes to the code prior to the occurrence of this new error message and even were I to fix it there's a good chance that once the website/app goes live the exact same problem would reoccur in some form or other.

Update: Came in this morning and the app is now intermittently showing:

Assertion failed: Objectabort: ( statusText )always: ()complete:   
()done: ()error: ()fail: ()getAllResponseHeaders: ()getResponseHeader: 
( key )overrideMimeType: ( type )pipe: ( /* fnDone, fnFail, fnProgress 
*/ )progress: ()promise: ( obj )readyState: 4responseText: "<br 
/>↵<b>Deprecated</b>:  Automatically populating $HTTP_RAW_POST_DATA is    
deprecated and will be removed in a future version. To avoid this 
warning set 'always_populate_raw_post_data' to '-1' in php.ini and use 
the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br  
/>↵<br />↵<b>Warning</b>:  Cannot modify header information - headers 
already sent in <b>Unknown</b> on line <b>0</b><br />↵{"data":
{"type":"stub-proposal","id":"P8XSGIFHTDEX6GI6DQOT","attributes": 
{"add_ons":
{"legal_helpline":null,"new_for_old":null,"personal_accident":true}},"relationships":{"selected_quote":{"data":{"type":"insurance-    
quote","id":"QGZ7SLFNRR3BPOBNB7RB"}},"quotes":{"data":
[{"type":"insurance-quote","id":"QFRQ05MH3MYHNKEXQMV1"},
{"type":"insurance-quote","id":"Q9SLIOJLPQRVIQA31R0T"},  
{"type":"insurance-quote","id":"QGZ7SLFNRR3BPOBNB7RB"},
{"type":"insurance-quote","id":"QVSEVJ0BDC59DF19MICQ"}]}},"links":
{"self":"http:\/\/local.theinsuranceemporium.co.uk\/data\/stub\/proposal\/P
8XSGIFHTDEX6GI6DQOT"},"meta":{"current":false,"add_ons":
{"legal_helpline":{"title":"Legal Helpline","description":"If   
there\u0027s something strange, in your neighbourhood. Who you gonna 
call?","type":"toggle","premium":
{"frequency":"L","rate":"96.00"}},"new_for_old":{"title":"New for 
Old","description":"We\u0027ll replace new for 
old.","type":"toggle","premium":
{"frequency":"L","rate":"37.00"}},"personal_accident":  
{"title":"Personal Accident","description":"Are you clumsy? Why not get 
some personal accident cover?!","type":"toggle","premium":     
{"frequency":"L","rate":"99.00"}}}}},"included":[{"type":"insurance-
quote","id":"QFRQ05MH3MYHNKEXQMV1","attributes":
{"package":"0ARGUBXV2TAQ2RPF6VNF","definition":
{"title":"Gold","sub_title":null,"description":"Gold insurance from The      
Insurance Emporium. Our top level insurance."},"premium":  
{"frequency":"L","rate":"24.30","discounted_amount":"24.30","discount_percentage":"0"},"total":{"amount":"24.30","frequency":"L"},"discounts":    
[],"benefits":[{"identifier":"public_liability","meta_data":
{"title":"Public Liability","description":"It\u0027s really great to 
have some public liability 
cover.","add_on":false},"value":1500000,"value_type":"stub"}, 
{"identifier":"legal_helpline","meta_data":{"title":"Legal 
Helpline","description":"If there\u0027s something strange, in your 
neighbourhood. Who you gonna 
call?","add_on":true},"value_type":"stub"},
{"identifier":"new_for_old","meta_data":{"title":"New for Old
","description":"We\u0027ll replace new for 
old.","add_on":true},"value_type":"stub"},
{"identifier":"personal_accident","meta_data":{"title":"Personal  
Accident","description":"Are you clumsy? Why not get some personal 
accident cover?!","add_on":true},"value_type":"stub"}]}},
{"type":"insurance-quote","id":"Q9SLIOJLPQRVIQA31R0T","attributes":
{"package":"00DPKFR8CKOEHPYKSI8H","definition":
{"title":"Gold","sub_title":null,"description":"Gold insurance from The 
Insurance Emporium. Our top level insurance."},"premium":    {"frequency":"A","rate":"220.00","discounted_amount":"220.00","discount_per    centage":"0"},"total":{"amount":"220.00","frequency":"A"},"discounts":
[],"benefits":[{"identifier":"public_liability","meta_data":
{"title":"Public Liability","description":"It\u0027s really great to 
have some public liability 
cover.","add_on":false},"value":1500000,"value_type":"stub"},
{"identifier":"legal_helpline","meta_data":{"title":"Legal 
Helpline","description":"If there\u0027s something strange, in your 
neighbourhood. Who you gonna    
call?","add_on":true},"value_type":"stub"},
{"identifier":"new_for_old","meta_data":{"title":"New for 
Old","description":"We\u0027ll replace new for 
old.","add_on":true},"value_type":"stub"},
{"identifier":"personal_accident","meta_data":{"title":"Personal 
Accident","description":"Are you clumsy? Why not get some personal 
accident cover?!","add_on":true},"value_type":"stub"}]}},
{"type":"insurance-quote","id":"QGZ7SLFNRR3BPOBNB7RB","attributes":
{"package":"0ZOQVO9WAF9QL34TBGE0","definition":
{"title":"Silver","sub_title":"Better than 
Bronze","description":"Silver insurance from The Insurance Emporium. 
Our mid-level insurance."},"premium": 
{"frequency":"L","rate":"36.30","discounted_amount":"36.30","discount_perce    ntage":"0"},"total":{"amount":"36.30","frequency":"L"},"discounts":     
[],"benefits":[{"identifier":"public_liability","meta_data":
{"title":"Public Liability","description":"It\u0027s really great to 
have some public liability     
cover.","add_on":false},"value":1500000,"value_type":"stub"},
{"identifier":"legal_helpline","meta_data":{"title":"Legal 
Helpline","description":"If there\u0027s something strange, in your 
neighbourhood. Who you gonna 
call?","add_on":true},"value_type":"stub"},
{"identifier":"new_for_old","meta_data":{"title":"New for 
Old","description":"We\u0027ll replace new for 
old.","add_on":true},"value_type":"stub"},
{"identifier":"personal_accident","meta_data":{"title":"Personal 
Accident","description":"Are you clumsy? Why not get some personal 
accident cover?!","add_on":true},"value_type":"stub"}]}},
{"type":"insurance-quote","id":"QVSEVJ0BDC59DF19MICQ","attributes":
{"package":"0P5K73S8WS1GZ83GIQ5A","definition":
{"title":"Silver","sub_title":"Better than 
Bronze","description":"Silver insurance from The Insurance Emporium. 
Our mid-level insurance."},"premium":
{"frequency":"A","rate":"395.00","discounted_amount":"395.00","discount_percentage":"0"},"total":{"amount":"395.00","frequency":"A"},"discounts":    [],"benefits":[{"identifier":"public_liability","meta_data":    
{"title":"Public Liability","description":"It\u0027s really great to have some public liability   
cover.","add_on":false},"value":1500000,"value_type":"stub"},
{"identifier":"legal_helpline","meta_data":{"title":"Legal 
Helpline","description":"If there\u0027s something strange, in your 
neighbourhood. Who you gonna 
call?","add_on":true},"value_type":"stub"},
{"identifier":"new_for_old","meta_data":{"title":"New for 
Old","description":"We\u0027ll replace new for 
old.","add_on":true},"value_type":"stub"},
{"identifier":"personal_accident","meta_data":{"title":"Personal 
Accident","description":"Are you clumsy? Why not get some personal 
accident cover?!","add_on":true},"value_type":"stub"}]}}]}
↵"setRequestHeader: ( name, value )state: ()status: 200statusCode: (  
map )statusText: "OK"success: ()then: ( /* fnDone, fnFail, fnProgress 
*/ )__proto__: Object(anonymous function) @ :4200/app/app.js:21

when instantiating the first view, and intermittently showing the Patch error (listed above) when stepping through to the second view. Again, no code has been changed by myself in the intervening time.

ADDITIONAL INFO: We have a MongoDB as well as an SQL one and different apps save to different places -- I think mine is actually passed through both atm????? We also have a bunch of stuff on an AS400 written in RPG and also a business logic layer which is also an asset library.

ADDITIONAL INFO UPDATE: I found a jQuery reference in the mother-site HTML as follows:

<script type="text/javascript" src="vendor/jquery.js"></script>

Library was called from the landing page, not required in with node or RequireJS and this was the reason I was not able to find it within my own application.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
Peter David Carter
  • 1,981
  • 3
  • 10
  • 9
  • 1
    Is your js app working with data (json format or something else) that you receive somehow, from server? if the application worked the day before, and you use whatnot to make the whole thing work, that implies the data you received was malformed (session timeout or something that made the server serve bad data). Perhaps you could inspect what JS works with? – Mjh Feb 25 '16 at 11:49
  • On one level, yes. Though there are a number of layers I am not currently privy to. It serialises the data. There's some stuff with a JSON object being both a string and not a string, and also with a view actually being a template and vice versa. The outgoing project leader actually does Ember,js in in his spare time and to be honest the whole thing is right at the upper limit of my pay-grade to even work out the right questions to ask, let alone fix it. – Peter David Carter Feb 25 '16 at 11:52
  • Did you try start looking at app.js line 21 and header.js line 90? – Philipp Feb 25 '16 at 11:54
  • Yes. It's the RSVP line. Line 90 added. If you can work out a way that's helpful then be my guest attempting it. – Peter David Carter Feb 25 '16 at 12:08
  • 1
    Added additional info. – Peter David Carter Feb 25 '16 at 12:21

0 Answers0