wkhtmltopdf / packaging

Packaging of wkhtmltopdf releases
https://wkhtmltopdf.org/downloads.html#stable
301 stars 136 forks source link

Symfony 5 + knp_snappy - failed to load and blocked access errors #146

Closed NBoulfroy closed 1 year ago

NBoulfroy commented 1 year ago

I have a malfunction with Symfony 5.4 and knp_snappy (1.9) with wkhtmltopdf (12.6). The application uses Webpack-Encore (1.16). This error in not present in my development environment (ISO with prod).

All environments are on Debian 11, with PostgreSQL 13 and PHP 7.4.

For 2 weeks, when I try to generate a PDF, there is an error that occurs on the environment where the application was deployed:

snappy.ERROR: An error happened while generating "/tmp/knp_snappy641b08fd3d2325.77113643.pdf". {"command":"xvfb-run /usr/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy641b08fd3d1788.78365795.html' '/tmp/knp_snappy641b08fd3d2325.77113643.pdf'","status":1,"stdout":"","stderr":"QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-peir'\nLoading page (1/2)\n[>                                                           ] 0%\r[=====================>                                      ] 35%\rWarning: Blocked access to file /PEIR/www/app/public/build/1.329d65bc.css\nWarning: Blocked access to file /PEIR/www/app/public/build/app.b69d4246.css\nWarning: Blocked access to file /PEIR/www/app/public/build/images/urne.png\nWarning: Blocked access to file /PEIR/www/app/public/build/images/logos_metiers/marianne/marianne.png\nWarning: Blocked access to file /PEIR/www/app/public/js/popper.js\nWarning: Blocked access to file /PEIR/www/app/public/build/runtime.d94b3b43.js\nWarning: Blocked access to file /PEIR/www/app/public/build/0.8ecf1583.js\nWarning: Blocked access to file /PEIR/www/app/public/build/1.0807a62f.js\nWarning: Blocked access to file /PEIR/www/app/public/build/app.bffbb929.js\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\nWarning: Blocked access to file \nError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol \"about\" is unknown\n[============================================================] 100%\rPrinting pages (2/2)                                               \n[>                                                           ] \rDone                                                           \nExit with code 1 due to network error: ProtocolUnknownError\n"} []

This is my knp_snappy file configuration:

knp_snappy:
    pdf:
        enabled: true
        binary: '%env(WKHTMLTOPDF_PATH)%'
        options:
            enable-local-file-access: true
    image:
        enabled: true
        binary: '%env(WKHTMLTOIMAGE_PATH)%'
        options:
            enable-local-file-access: true
ashkulz commented 1 year ago

Please open a ticket in the knp_snappy repo, I'm not sure what this has to do with packaging of wkhtmltopdf.