I'm having a similar problem as: Find operation (AJAX request) rejected, not seen in the wire
However, in my case, I am making one request. This request works on normal page load. It fails to load silently after a form submit (not through ember), that redirects back to the same page. There is no AJAX request being made.
My main question is: how do I go about debugging issues like this?
What I've Tried
I've added console.log statements in all sorts of places to understand the request lifecycle.
Since I've read that promises can get rejected if something throws an exception within it, I've tried switching the chrome debugger to "Pause on all exceptions" (as opposed to "Pause on uncaught exceptions"). Of course it breaks at a bunch of exceptions like:
// This should fail with an exception
// Gecko does not error, returns false instead
try {
matches.call( div, "[test!='']:sizzle" );
But since I have a way to get the request to work and a way to get it to not work, I can easily compare the difference. I expected there to be an uncaught exception when my request failed, but no such luck.
I've also added a
Ember.RSVP.configure('onerror', function(error) {
console.log(error.message);
console.log(error.stack);
});
block, but it does not get called.
I've also poked around at different objects in the console to try and understand my application state:
store = App.__container__.lookup('store:main')
b = store.find('bundle')
b.isRejected // => true
b.reason.statusText // => "error"
Update: More Details
The project I am working on is backed by rails. I am using:
DEBUG: -------------------------------
DEBUG: Ember.VERSION : 1.0.0
DEBUG: Handlebars.VERSION : 1.0.0
DEBUG: jQuery.VERSION : 1.8.3
DEBUG: -------------------------------
And it doesn't show up in the debug output, but I'm using ember-data 1.0 beta 3:
// Version: v1.0.0-beta.3
// Last commit: 2259c27 (2013-09-28 19:24:07 -0700)
The app loads all of the bundles to render them and a form, but the form submits directly to rails. Rails processes the post request and redirects back to /
, where the ember app lives.
The first request to /
loads everything fine, but when I submit the form, and it redirects back, that's when my ajax call my call to store.find('bundle')
does nothing.
UPDATE
I've discovered that my issue is related to pusher (websockets).
The issue seems intermittent and I've only seen it in Chrome (I've only tested Firefox).
The issue went away when I disconnected from websockets before a page refresh.