Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The server crashes about once a day when sending a push notification. #4

Closed
sangh opened this issue Sep 5, 2012 · 1 comment
Closed

Comments

@sangh
Copy link

@sangh sangh commented Sep 5, 2012

I get this randomly:

/usr/lib/node_modules/tapchat/lib/tapchat/push_client.js:57
if (!response.statusCode.toString().match(/^2/)) {

TypeError: Cannot read property 'statusCode' of undefined
at Request.PushClient.sendPush as _callback
at Request.init.self.callback (/usr/lib/node_modules/tapchat/node_modules/request/main.js:119:22)
at Request.EventEmitter.emit (events.js:88:17)
at ClientRequest.Request.init.self.clientErrorHandler (/usr/lib/node_modules/tapchat/node_modules/request/main.js:207:10)
at ClientRequest.EventEmitter.emit (events.js:88:17)
at CleartextStream.socketErrorListener (http.js:1330:9)
at CleartextStream.EventEmitter.emit (events.js:88:17)
at Socket.onerror (tls.js:1296:17)
at Socket.EventEmitter.emit (events.js:115:20)
at Socket.connect.require.lookup.addressType (net.js:697:16)

I think it should be as easy as changing lines 57-59 from:

if (!response.statusCode.toString().match(/^2/)) {
  Log.error("Error sending push notification: " + response.statusCode);
}

To:

if (typeof(response) === 'undefined') {
    Log.error("Error sending push notification, response undefined.");
} else if (!response.statusCode.toString().match(/^2/)) {
    Log.error("Error sending push notification: " + response.statusCode);
}

Am I wrong?

@codebutler
Copy link
Contributor

@codebutler codebutler commented Oct 25, 2012

This is fixed in dea971b and will be included in the next release.

@codebutler codebutler closed this Oct 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants