You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having an odd error here that I can't seem to track down. I am new to rabbitmq and rabbit.js so I am likely doing something wrong. I am trying to setup a REQ/REP and even this simple example is failing when I send a message.
Here is the code from my server:
"use strict";varcontext=rabbit.createContext("amqp://"+process.env.RABBITMQ_USER+":"+process.env.RABBITMQ_PASSWORD+"@"+process.env.RABBITMQ_1_PORT_5672_TCP_ADDR+":"+process.env.RABBITMQ_1_PORT_5672_TCP_PORT);context.on("ready",function(){console.log("Rabbit Listening");varrep=context.socket("REP");rep.setEncoding("utf8");rep.on("data",function(msg){vardata=JSON.parse(msg);console.log("Message Received %j",data);varjobId=data.job_id;varoutData={test: true};console.log("Replying with %j",outData);varres=JSON.stringify(outData);rep.write(res,"utf8");});rep.connect("pos.receipt.pdf");});context.on("error",function(e){console.error(e,"Rabbit Error");});
And here is the output I get:
Rabbit Listening
Message Received {"job_id":12711}
Replying with {"test":true}
events.js:125
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'length' of undefined
at Buffer.write (buffer.js:400:13)
at encodeBasicPublish (node_modules/rabbit.js/node_modules/amqplib/lib/defs.js:2167:10)
at module.exports.encodeMethod (node_modules/rabbit.js/node_modules/amqplib/lib/defs.js:3527:12)
at Connection.C.sendMessage (node_modules/rabbit.js/node_modules/amqplib/lib/connection.js:511:16)
at Channel.C.sendMessage (node_modules/rabbit.js/node_modules/amqplib/lib/channel.js:79:26)
at Channel.C.publish (node_modules/rabbit.js/node_modules/amqplib/lib/channel_model.js:343:15)
at Channel.C.sendToQueue (node_modules/rabbit.js/node_modules/amqplib/lib/channel_model.js:347:15)
at RepSocket.write (node_modules/rabbit.js/lib/sockets.js:490:16)
at RepSocket.<anonymous> (src/javascript/node/rabbit.js:20:9)
at emitOne (events.js:75:13
Any suggestions on how to debug this?
The text was updated successfully, but these errors were encountered:
I am having an odd error here that I can't seem to track down. I am new to rabbitmq and rabbit.js so I am likely doing something wrong. I am trying to setup a REQ/REP and even this simple example is failing when I send a message.
Here is the code from my server:
And here is the output I get:
Any suggestions on how to debug this?
The text was updated successfully, but these errors were encountered: