Fixed InvalidArgumentException when minifying JS

DragonByte Tech

Well-known member
Affected version
2.1.9
InvalidArgumentException: json_decode error: Syntax error src/vendor/guzzlehttp/guzzle/src/functions.php:304

Code:
#0 src/XF/Service/AddOn/JsMinifier.php(106): GuzzleHttp\json_decode('', true)
#1 src/XF/Service/AddOn/JsMinifier.php(59): XF\Service\AddOn\JsMinifier->request()
#2 src/XF/Service/AddOn/ReleaseBuilder.php(322): XF\Service\AddOn\JsMinifier->minify()
#3 src/XF/Service/AddOn/ReleaseBuilder.php(255): XF\Service\AddOn\ReleaseBuilder->minifyJs(Array)
#4 src/XF/Service/AddOn/ReleaseBuilder.php(390): XF\Service\AddOn\ReleaseBuilder->performBuildTasks()
#5 src/XF/Cli/Command/AddOn/BuildRelease.php(84): XF\Service\AddOn\ReleaseBuilder->build()
#6 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\AddOn\BuildRelease->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 src/vendor/symfony/console/Application.php(982): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\AddOn\BuildRelease), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 cmd.php(15): XF\Cli\Runner->run()
#12 {main}

From the looks of things, this will happen if the https://closure-compiler.appspot.com/compile endpoint returns an empty response, for whatever reason.

Re-running the build process will complete it without error.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.10).

Change log:
Throw a clearer error if closure compiler returns an unexpected response when minifying JS.
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom