我尝试使用https://github.com/rs/pushd作为推送通知服务器。
每当我尝试添加新订户时,服务器都会崩溃并显示此堆栈跟踪:
/home/ec2-user/push_server/pushd/node_modules/redis/index.js:602
throw err;
^
TypeError: Cannot set property 'id' of null
at /home/ec2-user/push_server/pushd/lib/api.coffee:20:21
at /home/ec2-user/push_server/pushd/lib/subscriber.coffee:133:21
at try_callback (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:592:9)
at RedisClient.return_reply (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:685:13)
at HiredisReplyParser.<anonymous> (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:321:14)
at HiredisReplyParser.emit (events.js:95:17)
at HiredisReplyParser.execute (/home/ec2-user/push_server/pushd/node_modules/redis/lib/parser/hiredis.js:43:18)
at RedisClient.on_data (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:547:27)
at Socket.<anonymous> (/home/ec2-user/push_server/pushd/node_modules/redis/index.js:102:14)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:765:14)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at Socket.Readable.push (_stream_readable.js:128:10)
at TCP.onread (net.js:529:21)
这是应添加新订户的命令(示例来自文档),并导致崩溃:
curl -d proto=apns -d token=FE66489F304DC75B8D6E8200DFF8A456E8DAEACEC428B427E9518741C92C6660 -d lang=fr -d badge=0 -d category=show -d contentAvailable=true http://localhost/subscribers
在将订户添加到数据库之前发生崩溃。
服务器是AWS上的RHEL微实例
版本
Redis Server 2.8.19。
Node.js 0.10.36。
CoffeeScript 1.9.0
任何帮助将不胜感激。
答案 0 :(得分:3)
/lib/event.coffee
- throw new Error("Missing redis connection") if not redis?
+ throw new Error("Missing redis connection") if not @redis?
/lib/subscriber.coffee
- if info?.updated? # subscriber exists
+ if @info?.updated? # subscriber exists
# transform numeric value to number type
- for own key, value of info
+ for own key, value of @info