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

Sending message with large header throws exception #366

Closed
twatson83 opened this issue Jul 26, 2017 · 3 comments
Closed

Sending message with large header throws exception #366

twatson83 opened this issue Jul 26, 2017 · 3 comments

Comments

@twatson83
Copy link

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?

@michaelklishin
Copy link

@twatson83 bumping the value to e.g. 16 kiB should be an OK stop-gap measure. Please submit a PR? Also, what's the size of your string value?

@twatson83
Copy link
Author

The string is 10836 characters long. Ok I will submit a PR.

@twatson83
Copy link
Author

twatson83 commented Nov 14, 2019

This is now an issue again.

We store a JWT in the header which is now bigger the 16KiB for some users.

Can we increase the size to 64KiB?

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

3 participants