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

Does WeasyPrint works on AWS-Lambda ? #499

Closed
Prasengupta opened this issue Aug 18, 2017 · 22 comments
Closed

Does WeasyPrint works on AWS-Lambda ? #499

Prasengupta opened this issue Aug 18, 2017 · 22 comments

Comments

@Prasengupta
Copy link

Does weasy print supports in aws Lambda if so, can you guys point the libraries related to aws-lambda.

The weasy print is working like charm in my local windows machine I need to make it as a lambda function and store the pdf in aws s3.

Please help

@Prasengupta Prasengupta changed the title Can WeasyPrint works on AWS-Lambda Does WeasyPrint works on AWS-Lambda ? Aug 18, 2017
@liZe
Copy link
Member

liZe commented Aug 21, 2017

You can follow the information of #401 and add a section into the documentation if it works for you.

@liZe liZe closed this as completed Aug 21, 2017
@Prasengupta
Copy link
Author

@liZe I couldn't see anyone solved the issue. in#401.

Please let me know if you can solve or can you point me the solution?

@liZe
Copy link
Member

liZe commented Aug 21, 2017

I don't get your problem. Did you try to install WeasyPrint on AWS-Lambda? According to #401, there's no real problem except from the Pango installation, which seems to be solved in the issue.

@Prasengupta
Copy link
Author

Hi @liZe ,

Im even facing the same issue with pango-1.0 while uploading the weasy print library into the aws-Lambda.

The pango issue is solved in #401 ? can you please point the link what did they do. I couldn't see the solution on the #410

Error:

module initialization error: cannot load library pango-1.0: pango-1.0: cannot open shared object file: No such file or directory

@liZe
Copy link
Member

liZe commented Aug 21, 2017

I'm running WeasyPrint on AWS Lambda, the first run of my lambda function fails because it does not find some pango libs, I copied libpango-1.0.so.0.2800.1, libpangocairo-1.0.so.0.2800.1 and libpangoft2-1.0.so.0.2800.1 from Amazon Linux to the root of my lambda function package, I renamed the firt two .so to pango-1.0 and pangocairo-1.0 and now it is working.

I have had some problems with gif images that can be seen in #428 and my comment.

@Prasengupta
Copy link
Author

Yeah Sorry @liZe I just saw this comment. But can you help me out here how to download the "libpango-1.0.so.0.2800.1" and libpangocairo-1.0.so.0.2800.1 libpangocairo-1.0.so.0.2800.1 libpangoft2-1.0.so.0.2800.1 because im using windows os. Can you point me how to get those so files please

@liZe
Copy link
Member

liZe commented Aug 21, 2017

@Prasengupta I've never used AWS Lambda, I don't even know what it really is. I'm just carefully reading the comments and searching on the Internet. I'm sure you can do that too.

It's my last comment 😄.

Amazon provides a Linux distribution called Amazon Linux. This distribution includes packages, including Pango. @y0rd4nis took the files from this package and put them in the root of his/her lambda function package. He/She then renamed these files, and it worked.

@Prasengupta
Copy link
Author

Prasengupta commented Aug 21, 2017

@liZe Hey Bro thanks for the help it worked for me and genrating an excellent pdf to aws-s3. Don't worry I will do documentation for weasyprint using aws-lambda and saving resulting pdf to aws-s3
. Because no one should face the problem like me.

@cgreening
Copy link

@Prasengupta did you every document this?

@Prasengupta
Copy link
Author

@cgreening Yes, I have done but not uploaded. Will upload in my git account and share with the public. It takes time

@vladholubiev
Copy link

@Prasengupta did you ever upload this?

@Prasengupta
Copy link
Author

Prasengupta commented Nov 9, 2017 via email

@muke5hy
Copy link

muke5hy commented Nov 20, 2017

@Prasengupta Did you got the chance to update Git with your example?

@liZe
Copy link
Member

liZe commented Nov 20, 2017

Related to #428.

@Prasengupta
Copy link
Author

Prasengupta commented Nov 21, 2017

Guys below is the git link where you can download the weasy print library which works in AWS lambda.

https://github.com/Prasengupta/weasyprint_for_awslambda

Will try to upload the full documentation with an example in my git account.

Please raise a ticket if you face any issues.

@richance
Copy link

richance commented Jan 6, 2018

Everything works perfect now! Prasengupta fixed all issues and I use his code for my live project
Thank you :)

@Prasengupta
Copy link
Author

Thank you @richance

@lclpedro
Copy link

@richance How exactly did you do it? just dropped the .zip and climbed in aws? how did deploy?

@Prasengupta
Copy link
Author

@lclpedro .

Download the zip file/extract it and include your handler file which has the main code of using weasyprint in the zip file and upload it in your lambda.

@Comm4nd0
Copy link

@lclpedro .

Download the zip file/extract it and include your handler file which has the main code of using weasyprint in the zip file and upload it in your lambda.

this make no sense! i'm having the same issue but i can't work it out at all!

@Prasengupta
Copy link
Author

@lclpedro where are you running your code ?.

@seanfdnn
Copy link

I created a repo with a Docker image that will create a Lambda layer with Weasy native libraries that is compatible with the Python 3.7 runtime https://github.com/seanfdnn/weasyprint_lambda

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

9 participants