New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wkhtmltopdf ContentNotFoundError #19701
Comments
In addition to the host_name key, add the corresponding domain name entry to the /etc/hosts file as mentioned in the documentation here. I've mentioned the bench command below for your reference.
|
thanks, @jugalgalaxyz, this might be a docker issue.
|
Same issue was with us too, if we remove this option from Line 121 in 1bae6a2
Then it will not give the error. So, the question is
Which option shall be preferred. |
@revant thanks for the update, as we checked it, default is kept blank and configurator will add the needed settings, but in the default configuration and as per current frappe_docker if we configure the production environment via docker it just not allowing the PDF generation. Adding "host_name": "http://127.0.0.1" in local dev machine works when there is no site(domain) name but when we do it with behind docker production(traefik / nginx) it throws frappe.exceptions.ValidationError: PDF generation failed because of broken image links. We also tried it with adding entry in backend container /etc/hosts added with 127.0.0.1 livedomain.example.com but that too did not worked... Problem happens due to Line 52 in 1bae6a2
Where scrub_urls will expand all urls to full url with port as 8000, and because port 8000 will never be accessible from web due to behind traefik & firewall. Finally Adding "host_name": "https://livedomain.example.com:443" has made it possible to get print working, but if we omit the port then it will add the 8000 as port in full url and from web it will not be accessible and will again throw error. Reference: Line 1623 in 1bae6a2
If I am missing something then please help, and if I have valid point then it would be great if we can add this to docker documentation, as to add host_name in site_config with port specified either 80 / 443. |
see also:
|
In case anybody stumbles upon this issue on Windows with Docker or Podman while working on local dev with port 8080 and plain old 127.0.0,1 (personally, I'm using using Podman 4.9.4 with docker-compose 2.23 and I'm running everything with Using |
Information about bug
When I enter a
DocType
and click thePrint
button and then click thePDF
button I get the reported error.the original error was connection refused.
Traceback (most recent call last): File "apps/frappe/frappe/app.py", line 69, in application response = frappe.api.handle() File "apps/frappe/frappe/api.py", line 54, in handle return frappe.handler.handle() File "apps/frappe/frappe/handler.py", line 45, in handle data = execute_cmd(cmd) File "apps/frappe/frappe/handler.py", line 83, in execute_cmd return frappe.call(method, **frappe.form_dict) File "apps/frappe/frappe/__init__.py", line 1595, in call return fn(*args, **newargs) File "apps/frappe/frappe/utils/print_format.py", line 129, in download_pdf pdf_file = frappe.get_print( File "apps/frappe/frappe/__init__.py", line 2028, in get_print return get_pdf(html, options=pdf_options, output=output) File "apps/frappe/frappe/utils/pdf.py", line 38, in get_pdf filedata = pdfkit.from_string(html, options=options or {}, verbose=True) File "env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string return r.to_pdf(output_path) File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf self.handle_error(exit_code, stderr) File "env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error raise IOError('wkhtmltopdf reported an error:\n' + stderr) OSError: wkhtmltopdf reported an error: Exit with code 1 due to network error: ConnectionRefusedError
i added
"host_name": "http://127.0.0.1",
to the site_config.json suggested by a forum post that then produced the below error.Module
selling
Version
Installed Apps
ERPNext: v14.13.0 (version-14)
Frappe Framework: v14.23.0 (version-14)
Frappe HR: v1.0.0 (develop)
Frappe LMS: v0.0.1 (main)
Payments: v0.0.1 (develop)
Wiki: v0.0.1 (master)
Installation method
docker
Relevant log output / Stack trace / Full Error Message.
The text was updated successfully, but these errors were encountered: