Sitelet https://github.com/JazzCore/python-pdfkit/issues/255
Skip to content

Trouble Including wkhtmltopdf Binary in AWS Lambda Deployment Package #255

Description

@jorgesisco

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions