But if the login_name field becomes required then deserialization fails and provides the following error:
libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type "ptest.LoginReq" because it is missing required fields: login_name
undefined:1
function(self) { var f = this; return function(arg) { return f.call(self,
^
Error: Malformed message
at Function.parse (unknown source)
at Object. (/home/ec2-user/dev/tests/msgs/test.js:14:24)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Everything works if the proto file is this:
package ptest; message LoginReq { optional string login_name = 1; optional string password = 2; }
But if the login_name field becomes required then deserialization fails and provides the following error:
libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message of type "ptest.LoginReq" because it is missing required fields: login_name
undefined:1 function(self) { var f = this; return function(arg) { return f.call(self, ^ Error: Malformed message at Function.parse (unknown source) at Object. (/home/ec2-user/dev/tests/msgs/test.js:14:24)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)