TWIG Template - JSON Size Limit?

Your software
My Mautic version is: v4.1.2
My PHP version is: PHP Version 7.4.26
My Database type and version is: Ver 15.1 Distrib 10.5.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Your problem
My problem is:

Hi guys,

I hope you’re keeping well and can help us with a bug we’ve found on the TWIG Template plugin.

In general, the TWIG Template works - we are able to pass via API a JSON payload to send an email and have stringified a payload, which we then use the json_decode_html to pull the string and loop through and print these within the email e.g. an order confirmation with a list of products.

We’ve uncovered a bug however when the string goes beyond a certain a size e.g. a large number of products; then we get an error 500 on the API request. We have eliminated the issue being the JSON/Data as we started with a JSON payload that worked, and then incrementally added the same product to the payload until a point where we started receiving the error 500.

We tried sending the same large JSON payload to an email that doesn’t contain the TWIG Template and the email (hello world) sends successfully (though it doesn’t print the products without Twig Template). Once we add the TWIG block into the email then we get the error 500. Again, this only happens after a certain number of products are added i.e. certain string size.

We have also carried out a test copying the content directly into the Mautic code editor, and we received the mail without problems.

NOTE: When performing this test we experienced slowness in the browser to be able to save the changes.

This leads us to conclude the following:

  • Is there a json_decode string limit in TWIG template plugin?

  • Is there a json_decode string limit in TWIG template plugin via API post request?

  • Is there a setting to increase payload delivery through the Mautic API?

NOTE: For your information, we have increased “post_max_size” to unlimited but the result is still the same.

Many thanks for any assistance that you can offer.

These errors are showing in the log:

NOTE: What is shown in the logs has nothing to do with my problem

[2022-04-05 12:55:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:55:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:56:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:56:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:57:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:57:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:58:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:58:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:59:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:59:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:00:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:00:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:01:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:01:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:02:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:02:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:03:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:03:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:04:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:04:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:05:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:05:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:06:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:06:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:07:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:07:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:08:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:08:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:09:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:09:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:10:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:10:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:11:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:11:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:12:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:12:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:13:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:13:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:14:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:14:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1

Hi guys,

I hope you’re well.

Any thoughts on this? @joeyk @kuzmany @rcheesley

Thanks!

Hi, I use Mautic 4.3.1 and was not able to send HTML in template with API.
Is there special considerations to send HTML in template property with API of TwigTemplate ?
If you have any information I am awhere
Best