Skip to content

Sending message with large header throws exception #366

@twatson83

Description

@twatson83

I need to be able to pass a large encrypted string as a header when sending messages. Below is the code used to send the message,

this.channel.sendToQueue(ep, message, { headers: messageHeaders, messageId: messageId });

And here is the exception that is thrown.

RangeError: Index out of range
    at checkInt (buffer.js:1045:11)
    at Buffer.writeUInt8 (buffer.js:1091:5)
    at encodeTable (codec.js:83:18)
    at encodeBasicProperties (defs.js:2773:11)
    at module.exports.encodeProperties (defs.js:3544:12)
    at Connection.C.sendMessage (connection.js:542:16)
    at Channel.C.sendMessage (channel.js:85:26)
    at Channel.publish (callback_model.js:171:17)
    at Channel.sendToQueue (callback_model.js:175:15)

I believe the issue is here

https://github.com/squaremo/amqp.node/blob/master/bin/generate-defs.js#L125

Increasing the SCRATCH buffer size fixes the issue, but maybe this value shouldn't be hard coded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions