I load by PB schema as follows:
var Schema = require('protobuf').Schema;
var schema = new Schema(fs.readFileSync('/home/ubuntu/workspace/test.desc'));
Then for a post I expect a pb, I have the following.
app.post('/mypost', function(req, res){
var Feed = schema['MyRequest'];
var aFeed = Feed.parse(req.body);
var serialized = Feed.serialize(aFeed);
});
I am rather new to node.js and also getting post data. is the req.body the buffer from the post data?
TypeError: Argument should be a buffer
at Function.parse (unknown source)
at /home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/bidder.js:71:22
at callbacks (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:272:11)
at param (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:246:11)
at pass (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:280:4)
at Object.handle (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/lib/router/index.js:45:10)
at next (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/http.js:204:15)
at Object.methodOverride [as handle] (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:35:5)
at next (/home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbNodejsServer/node_modules/express/node_modules/connect/lib/http.js:204:15)