My application is deployed on digitalocean, and it's using wkhtmltopdf to generate pdf. I have the exact same image deployed on my local cluster on Ubuntu and there's no problem there; however, when the same image is deployed on digitalocean, the application complains Exit with code 1 due to network error: RemoteHostClosedError.
The interesting thing is when I used the command wkhtmltopdf http://app-IP/settings/testPdf test.pdf
on my local cluster pod, it works. But when I do the same command on the pod deployed on digitalocean, the error occurs. This leads me to think there is something I'm missing on digitalocean and not my application code.
This is the app stack trace
2022-01-20 19:28:05 Error: [RuntimeException] The exit status code '1' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
Error: Failed loading page http://app-ip/settings/testPdf (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: RemoteHostClosedError
"
stdout: ""
command: /usr/local/bin/wkhtmltopdf --lowquality --dpi '100' --orientation 'portrait' 'http://app-ip/settings/testPdf' '/tmp/knp_snappy61e9b7c514cd66.35006781.pdf'.
Request URL: /settings/edit/PDFCONFIG
Stack Trace:
#0 /var/www/sites/eramba_community/app/upgrade/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php(177): Knp\Snappy\AbstractGenerator->checkProcessStatus(1, '', 'Loading pages (...', '/usr/local/bin/...')
#1 /var/www/sites/eramba_community/app/upgrade/vendor/knplabs/knp-snappy/src/Knp/Snappy/Pdf.php(63): Knp\Snappy\AbstractGenerator->generate('http://157.230....', '/tmp/knp_snappy...', Array, false)
#2 /var/www/sites/eramba_community/app/upgrade/vendor/knplabs/knp-snappy/src/Knp/Snappy/AbstractGenerator.php(221): Knp\Snappy\Pdf->generate('http://157.230....', '/tmp/knp_snappy...', Array)
#3 /var/www/sites/eramba_community/app/Lib/SystemHealthLib.php(648): Knp\Snappy\AbstractGenerator->getOutput('http://157.230....')
#4 /var/www/sites/eramba_community/app/Model/Setting.php(472): SystemHealthLib::pdfBinaryCheck('/usr/local/bin/...')
#5 /var/www/sites/eramba_community/app/Model/Setting.php(464): Setting::pdfBinaryCheck('/usr/local/bin/...')
#6 /var/www/sites/eramba_community/lib/Cake/Model/Validator/CakeValidationRule.php(275): Setting->validatePdfBinary(Array, Array)
#7 /var/www/sites/eramba_community/lib/Cake/Model/Validator/CakeValidationSet.php(135): CakeValidationRule->process('PDF_PATH_TO_BIN', Array, Array)
#8 /var/www/sites/eramba_community/lib/Cake/Model/ModelValidator.php(268): CakeValidationSet->validate(Array, false)
#9 /var/www/sites/eramba_community/lib/Cake/Model/ModelValidator.php(99): ModelValidator->errors(Array)
#10 /var/www/sites/eramba_community/lib/Cake/Model/Model.php(3502): ModelValidator->validates(Array)
#11 /var/www/sites/eramba_community/app/Controller/SettingsController.php(569): Model->validates(Array)
#12 /var/www/sites/eramba_community/app/Controller/SettingsController.php(119): SettingsController->manageCallbacks('PDF_PATH_TO_BIN', '/usr/local/bin/...')
#13 [internal function]: SettingsController->edit('PDFCONFIG')
#14 /var/www/sites/eramba_community/lib/Cake/Controller/Controller.php(499): ReflectionMethod->invokeArgs(Object(SettingsController), Array)
#15 /var/www/sites/eramba_community/app/Plugin/Crud/Lib/CrudControllerTrait.php(31): Controller->invokeAction(Object(CakeRequest))
#16 /var/www/sites/eramba_community/lib/Cake/Routing/Dispatcher.php(193): AppController->invokeAction(Object(CakeRequest))
#17 /var/www/sites/eramba_community/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(SettingsController), Object(CakeRequest))
#18 /var/www/sites/eramba_community/app/webroot/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#19 {main}