enupal / snapshot

PDF or Image generation from a URL or HTML page easily for Craft CMS
https://enupal.com/craft-plugins/enupal-snapshot/
Other
11 stars 3 forks source link

Something went wrong in the test. Please check the path and your logs while setting wkhtmltopdf and wkhtmltoimage paths #46

Open romainpoirier opened 2 years ago

romainpoirier commented 2 years ago

Description

I am running Mac OS Monterey 12.2.1 and I am running locally my server using MAMP Pro 6.6.1 + PHP 7.4.21. I followed the plugin install documentation, which is from previous Mac OS / brew version.

I had to run brew install --cask wkhtmltopdf instead of brew cask install wkhtmltopdf. After install, the wkhtmltopdf and wkhtmltoimage paths I get are default one (/usr/local/bin/wkhtmltopdf and /usr/local/bin/wkhtmltoimage).

However, when I save the settings in /admin/settings/plugins/enupal-snapshot I always get this error: Something went wrong in the test. Please check the path and your logs right under the fields. This happens even if I leave the Absolute Binary Path of wkhtmltopdf lib and Absolute Binary Path of wkhtmltoimage lib fields empty, or if I fill them with the /usr/local/bin/wkhtmltopdf and /usr/local/bin/wkhtmltoimage values, or from .env values.

Unfortunately, I see nothing related in the logs, but I can see that PDF and PNG sample files are generated in my assets (both are displaying a sample Hello world). All these settings are lost after save, probably because of the error. While the paths are correct, I don't understand what's going wrong.

On front-end, I did a simple test:

{% set urls = {0: 'https://www.google.com', 1:'http://enupal.com/en'} %}
{%  set settings = {
        filename: 'my-first-pdf.pdf'
    }
%}
{{ craft.enupalsnapshot.displayUrl(urls, settings) }}

Then I get Something went wrong when creating the PDF file, please check your logs, but I can only see this in the logs:

2022-03-10 10:27:39 [-][1][-][error][enupal\snapshot\Snapshot::error] Something went wrong when creating the PDF file: The exit status code '127' says something went wrong:
stderr: "sh: : command not found

Any idea how to setup this? Thank you!

Additional info

andrelopez commented 2 years ago

Hi @romainpoirier could you please recreate the error and send back to us a zip file of the following folder?

storage/logs

Please send the file to support@enupal.com

romainpoirier commented 2 years ago

Hi @andrelopez, I'm sorry as there weren't any solution at the time of this issue, I had to go with another solution. So I can't replicate it as I haven't this setup anymore.

iamdangavin commented 2 years ago

Digging this one back up because I am having the same exact issue on my local install. Same errors, can't save settings with the path provided from the brew install. Makes a sample PDF in the proper place, but loses all settings if I leave the page.

Email log file

andrelopez commented 2 years ago

Hi @iamdangavin what is your local stack (how do you run craft cms)?

iamdangavin commented 2 years ago

Mamp Pro (php 8.0.8), Codekit, Craft CMS (4.2.5.1). Site is stored in /Sites/_labs/{domain.com}/

iamdangavin commented 2 years ago

@andrelopez seeing if you had any thoughts or updates on this. Thanks!