amqp-node / amqplib

AMQP 0-9-1 library and client for Node.JS
https://amqp-node.github.io/amqplib/
Other
3.68k stars 475 forks source link

Error when an empty message is consumed. #27

Closed ghost closed 10 years ago

ghost commented 10 years ago

Currently we use an RPC style system that uses status codes in the header (as well as correlationId & replyTo) to flag the status of the call (the body is used to hold results or an error message/stacktrace).

This often results in an empty message body but with the header & properties fields populated.

On this condition we seem to be getting an error at the library level:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Expected content frame after headers
    at Channel.C.closeBecause (/Users/bjc/Workspace/ol-trackingid-tag-upload/node_modules/amqplib/lib/channel.js:183:11)
    at Channel.C.acceptMessageFrame (/Users/bjc/Workspace/ol-trackingid-tag-upload/node_modules/amqplib/lib/channel.js:216:10)
    at Channel.C.accept (/Users/bjc/Workspace/ol-trackingid-tag-upload/node_modules/amqplib/lib/channel.js:305:17)
    at Connection.mainAccept [as accept] (/Users/bjc/Workspace/ol-trackingid-tag-upload/node_modules/amqplib/lib/connection.js:36:33)
    at Socket.go (/Users/bjc/Workspace/ol-trackingid-tag-upload/node_modules/amqplib/lib/frame.js:76:12)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

Sorry not to have a patch or anything more helpful than this, and thanks for all the hard work on this library.

Apologies, just found issue #10. Now if only I could retract this as a duplicate...

squaremo commented 10 years ago

(There's a release with the fix for #10 published to npm, v0.1.0)