Reputation: 123
I am trying to connect to firebase using my Node.js web app, but beginning last Friday I started to experience issues that intermittently caused my app not to receive any data from firebase and to timing out. I think it's an issue with firebase, but to be safe I reverted to an older/simpler version that had worked fine. However, my old version also did not work.
For debugging I have been focusing on a "test" scenario. In my app.js file I have the route app.get('/listener/test', listener.test);
and in my listener route I have:
DeviceListener.prototype.test = function() {
var url = 'wss://developer-api.nest.com/';
var dataRef =new Firebase(url);
console.log("Testing. Attempting to authenticate firebase.");
dataRef.auth(this.token, function (error, result) {
if (error) console.log("Firebase Authentication Error: " + error);
else {
console.log("Firebase authentication success");
dataRef.on("child_changed", function(snapshot){
var device_data = snapshot.val();
console.log(JSON.stringify(device_data));
console.log("Device Changed");
});
}
});
}
However, when I go to /listener/test
I only have the console output:
at=info method=GET path="/listener/test" host=ooma2.herokuapp.com request_id=f1de66a2-2086-4aa1-b4a9-5a399110850a fwd="38.112.2.94" dyno=web.1 connect=3ms service=30ms status=302 bytes=707
heroku/router: at=info method=GET path="/" host=ooma2.herokuapp.com request_id=f8c42a92-8e0d-489c-ba37-fc10a7286d4d fwd="38.112.2.94" dyno=web.1 connect=2ms service=13ms status=302 bytes=698
heroku/router: at=info method=GET path="/login" host=ooma2.herokuapp.com request_id=3826633b-3159-4495-82a4-966739066b8a fwd="38.112.2.94" dyno=web.1 connect=2ms service=26ms status=304 bytes=738
app/web.1: Testing. Attempting to authenticate firebase.
heroku/router: at=info method=GET path="/stylesheet/login.css" host=ooma2.herokuapp.com request_id=057aa990-57ee-4aac-91f2-e1543d2a9c02 fwd="38.112.2.94" dyno=web.1 connect=2ms service=7ms status=404 bytes=679
heroku/router: at=info method=GET path="/stylesheet/ooma.css" host=ooma2.herokuapp.com request_id=2f483b7b-a8f5-467a-bdf4-4c594ca0c2e0 fwd="38.112.2.94" dyno=web.1 connect=2ms service=5ms status=404 bytes=678
heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/bower_components/firebase/firebase.js" host=ooma2.herokuapp.com request_id=533d2333-bb0e-4fcf-b81f-fc0dd5bd1808 fwd="38.112.2.94" dyno=web.1 connect=3ms service=30001ms status=503 bytes=681
heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/js/login.js" host=ooma2.herokuapp.com request_id=971d1823-a9fd-4f85-b488-2d77f209acec fwd="38.112.2.94" dyno=web.1 connect=1ms service=30001ms status=503 bytes=655
heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/bower_components/jquery-cookie/jquery.cookie.js" host=ooma2.herokuapp.com request_id=bcde664a-e580-4854-bd12-47df563464f0 fwd="38.112.2.94" dyno=web.1 connect=1ms service=30001ms status=503 bytes=691
heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/bower_components/jquery/dist/jquery.js" host=ooma2.herokuapp.com request_id=969c6fd0-9801-4f78-af59-10e63ad52fa9 fwd="38.112.2.94" dyno=web.1 connect=33ms service=30033ms status=503 bytes=684
Since neither the message Firebase Authentication Error: ...
nor Firebase Authentication Success
are logged, I guess that means the authentication never completed.
Is that sound logic? Because if so, I'm not sure how to proceed in fixing/coping with it. I would greatly appreciate any thoughts and ideas about this, or any alternative explanations. Also, has anybody else experienced anything similar? Especially beginning around 8/1/14?
Upvotes: 2
Views: 3066
Reputation: 71
I've been having the same problem for the past couple of days. This evening I downgraded my version of node to v0.10.20, and the problem seems to have been fixed, but I will only know with more time. You might try putting this in package.json:
"engines": {
"node": "0.10.20",
"npm": ">=1.3"
}
(Earlier I posted an answer about writing a 'heartbeat' function which would ping Firebase every 30 seconds to prevent a timeout. That seemed to work for awhile, but the problem came back later.)
Upvotes: 2