Skip to content
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

Trouble Including wkhtmltopdf Binary in AWS Lambda Deployment Package #255

Open
jorgesisco opened this issue Dec 2, 2023 · 0 comments
Open

Comments

@jorgesisco
Copy link

I'm encountering an issue where my AWS Lambda function cannot find the wkhtmltopdf executable despite it being included in the deployment package. The error thrown is:

Error processing message: No wkhtmltopdf executable found: \"\"\nIf this file exists please check
 that this process can read it or you can pass path to it manually in method call, check README. 
Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

To resolve this, I've attempted the following without success:

  • Including the wkhtmltopdf binary in the deployment package via the pdfkit configuration.
  • Ensuring the binary exists in the expected path and has the correct permissions set (chmod +x).

Here's the relevant part of my code:

import os
import pdfkit

current_script_dir = os.path.dirname(os.path.realpath(__file__))
path_to_wkhtmltopdf = os.path.join(current_script_dir, "wkhtmltox-0.12.6-4.amazonlinux2_lambda/bin/wkhtmltopdf")
config = pdfkit.configuration(wkhtmltopdf=path_to_wkhtmltopdf)

I suspect I'm missing a step in the build or deployment process. I'm looking for guidance on how to ensure the wkhtmltopdf binary is correctly included in my Lambda function's deployment package and is discoverable at runtime. Any help or insight into what might be going wrong would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant