OSError: wkhtmltopdf exited with non-zero code 127. error while loading shared libraries: libpng15.s

%3CLINGO-SUB%20id%3D%22lingo-sub-3208402%22%20slang%3D%22en-US%22%3EOSError%3A%20wkhtmltopdf%20exited%20with%20non-zero%20code%20127.%20error%20while%20loading%20shared%20libraries%3A%20libpng15.s%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3208402%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI've%20been%20trying%20to%20build%20an%20app%20function%20for%20an%20auto-generating%20pdf%20task%20using%20pdfkit%20module.%20Though%20somehow%20Azure%20couldn't%20find%20the%20wkhtmltopdf%20(I've%20listed%20it%20in%20requirement.txt%20to%20install%20it%20as%20well)%20for%20pdfkit.%20Thus%20I%20manually%20downloaded%20it%20from%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwkhtmltopdf.org%2Fdownloads.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%3Ewkhtmltopdf%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B-%26gt%3B%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fwkhtmltopdf%2Fpackaging%2Freleases%2Fdownload%2F0.12.6-4%2Fwkhtmltox-0.12.6-4.amazonlinux2_lambda.zip%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%3Elambda%20zip%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3Band%20deployed%20the%20package%20to%20the%20Azure%20function%20app%20as%20well.%20And%20manually%20configure%20the%20path%20for%20pdfkit%20like%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Econfig%20%3D%20pdfkit.configuration(wkhtmltopdf%3D'TableandChart%2Fwkhtmltox-0.12.6-4.amazonlinux2_lambda%2Fbin%2Fwkhtmltopdf')%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIt%20seemed%20to%20work%20but%26nbsp%3Bthen%20the%20other%20error%20popped%20up%20(though%20I've%20also%20included%20the%20libs%20like%20libpng15.so.15%20in%20TableandChart%2Fwkhtmltox-0.12.6-4.amazonlinux2_lambda%2Flib%2F%20when%20deploying)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EResult%3A%20Failure%20Exception%3A%20OSError%3A%20wkhtmltopdf%20exited%20with%20non-zero%20code%20127.%20error%3A%20TableandChart%2Fwkhtmltox-0.12.6-4.amazonlinux2_lambda%2Fbin%2Fwkhtmltopdf%3A%20error%20while%20loading%20shared%20libraries%3A%20libpng15.so.15%3A%20cannot%20open%20shared%20object%20file%3A%20No%20such%20file%20or%20directory%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Hung_ChienHsiang_1-1645694898132.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350901i79CA237D24291F41%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Hung_ChienHsiang_1-1645694898132.png%22%20alt%3D%22Hung_ChienHsiang_1-1645694898132.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Hung_ChienHsiang_0-1645694886316.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350900i8E568CDCDC6B4ABF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Hung_ChienHsiang_0-1645694886316.png%22%20alt%3D%22Hung_ChienHsiang_0-1645694886316.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ehas%20anyone%20faced%20a%20similar%20situation%2C%20or%20does%20anyone%20know%20how%20to%20correctly%20adopt%20pdfkit%20in%20Azure%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThank%20you%20in%20advance%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHsiang%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular Visitor

I've been trying to build an app function for an auto-generating pdf task using pdfkit module. Though somehow Azure couldn't find the wkhtmltopdf (I've listed it in requirement.txt to install it as well) for pdfkit. Thus I manually downloaded it from wkhtmltopdf -> lambda zip and deployed the package to the Azure function app as well. And manually configure the path for pdfkit like: 

config = pdfkit.configuration(wkhtmltopdf='TableandChart/wkhtmltox-0.12.6-4.amazonlinux2_lambda/bin/wkhtmltopdf')

 

It seemed to work but then the other error popped up (though I've also included the libs like libpng15.so.15 in TableandChart/wkhtmltox-0.12.6-4.amazonlinux2_lambda/lib/ when deploying)

 

Result: Failure Exception: OSError: wkhtmltopdf exited with non-zero code 127. error: TableandChart/wkhtmltox-0.12.6-4.amazonlinux2_lambda/bin/wkhtmltopdf: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory

 

Hung_ChienHsiang_1-1645694898132.png

 

Hung_ChienHsiang_0-1645694886316.png

 

has anyone faced a similar situation, or does anyone know how to correctly adopt pdfkit in Azure

 

Thank you in advance,

Hsiang

0 Replies