Support » Plugin: PDF Invoices & Packing Slips for WooCommerce » Exception: not authorized after upgrade

  • Resolved repli2dev

    (@repli2dev)


    Hi, after update to 3.0.0 from 2.4.15 our invoice generation has started to fail with visible error:

    Exception: not authorized ‘///<ABSOLUTE PATH>’ @ error/constitute.c/ReadImage/420

    Part of trace: Cpdf.php 5729: Imagick->__construct()

    Any ideas what went wrong?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hi @repli2dev

    Can you please share a screenshot of your System Configuration from WooCommerce > PDF Invoices > Status? You can host your image here.

    Plugin Contributor Ewout

    (@pomegranate)

    @repli2dev does the <ABSOLUTE PATH> in your exception start with opt/bitnami? If so: https://wordpress.org/support/topic/exception-not-authorized/

    Thread Starter repli2dev

    (@repli2dev)

    Sadly i does not, it is an absolute path within the server to our hosting directory.

    Status page (of 2.4.15) https://ibb.co/KmT4ZcF

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @repli2dev

    Are you able to upgrade the Imagick library? That seems an issue with your version or configuration on that library.

    Thread Starter repli2dev

    (@repli2dev)

    @alexmigf sadly the hosting says that 3.4.4 of php-imagick is the most up-to-date version in their system (Debain – see https://packages.debian.org/search?keywords=imagick&searchon=names&suite=stable&section=all)

    Can you please provide workaround?

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @repli2dev

    Which type of image are you using for the logo in the PDF? Do you have more images beside the logo?

    Thread Starter repli2dev

    (@repli2dev)

    We use PNG for the logo. No extra images anywhere.

    Switching to JPG has worked, though it is bit blurry.

    Also I have tried to reproduce it locally with PHP 7.4.30 and imagick 3.7.0 without much success :-/

    Plugin Contributor alexmigf

    (@alexmigf)

    Also I have tried to reproduce it locally with PHP 7.4.30 and imagick 3.7.0 without much success :-/

    Is still blurry locally?

    Dear all, I have a similar issue:

    
    Exception: not authorized 

    ///opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/2022/04/pawbies-new-with-wording-brown-landscape-300×150-trans.png’ @ error/constitute.c/ReadImage/420

    /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php (5729)

    #0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(5729): Imagick->__construct()
    #1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(5865): Dompdf\Cpdf->addImagePngAlpha()
    #2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Adapter/CPDF.php(677): Dompdf\Cpdf->addPngFromFile()
    #3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer/Image.php(68): Dompdf\Adapter\CPDF->image()
    #4 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(290): Dompdf\Renderer\Image->render()
    #5 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(129): Dompdf\Renderer->_render_frame()
    #6 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #7 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #8 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #9 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #10 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #11 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(196): Dompdf\Renderer->render()
    #12 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/Page.php(149): Dompdf\Renderer->render()
    #13 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(916): Dompdf\FrameReflower\Page->reflow()
    #14 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Dompdf.php(770): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #15 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-pdf-maker.php(52): Dompdf\Dompdf->render()
    #16 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(752): WPO\WC\PDF_Invoices\PDF_Maker->output()
    #17 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(814): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #18 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(376): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf()
    #19 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.php(307): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax()
    #20 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #21 /opt/bitnami/apps/wordpress/htdocs/wp-includes/plugin.php(476): WP_Hook->do_action()
    #22 /opt/bitnami/apps/wordpress/htdocs/wp-admin/admin-ajax.php(187): do_action()
    #23 {main}

    `

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @princematli, thanks for providing that stack trace!

    This seems to be a known issue related with Bitnami (see Exception: not authorized). As I mentioned there, two possible ways to fix this are the following:

    1. Convert your shop logo from PNG to JPEG
    2. Ask your hosting provider to update the IMagick PHP extension to the latest version (recommended)

    Let us know what path you followed and if it fixed this issue!

    Thanks for your feedback. I changed the image to a GIF and it works fine for new invoices. For past invoices, strange thing is, that I can’t update some of the old invoices with the new template data. Some can be updated and for some the error keep returning as the “old” image is still grabbed. Perhaps a cache issue? Just not sure why some can be updated and why some can’t.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @princematli,

    That’s a good question! We save some of your settings in the order data, like your store data and some document settings, so the PDF invoice display the configuration that you have at the moment of the document creation. This way, the old invoices will not be affected if you change your store address, or you update your logo design: this is required for the fiscal laws in several countries.

    However, if possible to update this info in your old orders. See this article to learn more: Show PDF documents with the latest settings

    I was able to identify as to why some invoices work and some not. My findings makes the situation even worse as the cause is related to the product thumbnails. Those product thumbnails that use .png files are affected. Obviously with a large number of product images this is a huge challenge.

    For now, unfortunately, I may need to disable the invoice part. So the test or change of logo file format won’t solve the issue. We would need to replace all image files which is obviously a no go.

    Any other workaround you could potentially think of?

    Added: I removed the product images from the customizer so that the invoice is generated without product images. This somewhat works but isn’t a desired solution 😉 What else is there we could look into besides updating the stack which is certainly not a short-term fix.

    Best,
    Christian

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Yes, you can try downgrading to v2.16.0:
    https://downloads.wordpress.org/plugin/woocommerce-pdf-invoices-packing-slips.2.16.0.zip

    However, even if this work, my recommendation is contacting your hosting provider and to ask them to update your IMagick PHP extension up to the latest version, so that you’re not stuck on this version, and you can update our plugin without issues.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.