Search code examples
laravelqueueiron.io

Iron.io: "Message must be no more than 64kB"


I am trying to send an Email through Iron.io service. Everything is working as expected except that if the body of the message is big I get this error.

Is there a way to bypass this limitation and fix the problem?

My Stack Trace Exception

[2014-06-11 17:48:07] local.ERROR: exception 'Http_Exception' with message 'http error: 400 | {"msg":"Message must be no more than 64kB"}' in /var/www/lbook/vendor/iron-io/iron_core/IronCore.class.php:264

0 /var/www/lbook/vendor/iron-io/iron_core/IronCore.class.php(256): IronCore->reportHttpError(400, '{"msg":"Message...')

1 /var/www/lbook/vendor/iron-io/iron_core/IronCore.class.php(230): IronCore->callWithRetries()

2 /var/www/lbook/vendor/iron-io/iron_mq/IronMQ.class.php(272): IronCore->apiCall('POST', 'projects/535a62...', Array)

3 /var/www/lbook/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php(81): IronMQ->postMessage('appdev', 'eyJpdiI6IjgzQVp...', Array)

4 /var/www/lbook/vendor/laravel/framework/src/Illuminate/Queue/IronQueue.php(66): Illuminate\Queue\IronQueue->pushRaw('{"job":"mailer@...', NULL)

5 [internal function]: Illuminate\Queue\IronQueue->push('mailer@handleQu...', Array, NULL)


Solution

  • 64KB is the maximum total message size allowed on that platform.

    You could

    1. gzip the message body or
    2. just send the data to be able to recreate the message, and not the entire thing or
    3. save the email into a database or elsewhere, and send an ID/reference for the worker to pickup and fetch