gorush icon indicating copy to clipboard operation
gorush copied to clipboard

rpc server runtime error

Open xnathanh opened this issue 8 years ago • 1 comments

thank you can support "badge category" but seems like something goes wrong, i got error when i try to use grpc on nodejs to call gorush


var messages = require('./gorush_pb');
var services = require('./gorush_grpc_pb');

var grpc = require('grpc');
exports.send = (platform, tokensList, message) => {
    let client = new services.GorushClient('xxxxx.xx.xx.xx:xxxx',
        grpc.credentials.createInsecure());
    let request = new messages.NotificationRequest();

    request.setPlatform(platform);
    request.setTokensList(tokensList);
    request.setMessage("hello");
    request.setTitle("hello2");
    request.setBadge(2);
    request.setCategory("mycategory");
    
    client.send(request, function(err, response) {
        if (response) {
            return response.getSuccess();
        }
        return false;
    });
};

error message on docker logs:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbfb8fb]

goroutine 137 [running]:
github.com/appleboy/gorush/rpc.(*Server).Send(0xc42088a010, 0x13123e0, 0xc420294ed0, 0xc420930280, 0xc42088a010, 0x4294d9, 0xc42088e070)
	/go/src/github.com/appleboy/gorush/rpc/server.go:62 +0x12b
github.com/appleboy/gorush/rpc/proto._Gorush_Send_Handler(0xcf0760, 0xc42088a010, 0x13123e0, 0xc420294ed0, 0xc42024c870, 0x0, 0x0, 0x0, 0x1308660, 0xc42007a008)
	/go/src/github.com/appleboy/gorush/rpc/proto/gorush.pb.go:288 +0x276
github.com/appleboy/gorush/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc420884000, 0x1315100, 0xc42090cb00, 0xc420236200, 0xc4208aa0c0, 0x13463b0, 0xc420294f30, 0x0, 0x0)
	/go/src/github.com/appleboy/gorush/vendor/google.golang.org/grpc/server.go:781 +0xab4
github.com/appleboy/gorush/vendor/google.golang.org/grpc.(*Server).handleStream(0xc420884000, 0x1315100, 0xc42090cb00, 0xc420236200, 0xc420294f30)
	/go/src/github.com/appleboy/gorush/vendor/google.golang.org/grpc/server.go:981 +0x1528
github.com/appleboy/gorush/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc4200170b0, 0xc420884000, 0x1315100, 0xc42090cb00, 0xc420236200)
	/go/src/github.com/appleboy/gorush/vendor/google.golang.org/grpc/server.go:551 +0x9f
created by github.com/appleboy/gorush/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
	/go/src/github.com/appleboy/gorush/vendor/google.golang.org/grpc/server.go:549 +0xa1

xnathanh avatar Jan 02 '18 10:01 xnathanh

@xnathanh I will take it.

appleboy avatar Jan 02 '18 14:01 appleboy