Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Queue.onMessage consumer function returned error: content is not a buffer module=amqp-ts #25

Open
pscanlon1 opened this issue Feb 25, 2018 · 3 comments

Comments

@pscanlon1
Copy link

I am receiving the message, with all the right details, and then I am seeing this error. Any ideas?

@razzeee
Copy link
Contributor

razzeee commented Jul 25, 2019

Did you figure this out?

@austin-beer
Copy link
Contributor

I encountered this error when receiving a message that had the replyTo (reply-to) field set. In that case, the message is treated as an RPC call. The amqp-ts library automatically sends the queue.activateConsumer onMessage function's return value to the sender (i.e. to wherever the replyTo field is set to). If your onMessage function doesn't return anything, you will get this error: "Queue.onMessage consumer function returned error: content is not a buffer module=amqp-ts".

https://github.com/abreits/amqp-ts/wiki/Queue-class#activateConsumer

@bruegth
Copy link

bruegth commented Jul 6, 2020

Seems documentation/example is wrong:

// rpc server that returns a Message
queue.activateConsumer((msg) => {
    var rpcParameters = msg.getContent();
    return new Amqp.Message(rpcParameters.value, {});
});

because return value for reply queue will be stringified:

content = new Buffer(JSON.stringify(content));

Or?

Kampfmoehre added a commit to droidsolutions/amqp-ts that referenced this issue Oct 15, 2020
adds an empty string when replying to and message content is undefined
see abreits#25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants