I'm trying to run a simple proof of concept running IronPDF on an AWS lambda. The code deploys fine, but upon invocation IronPDF can't unpack the binaries needed for Chromium to render my PDF.
IronPDF Installation Docs
I am using serverless + csharp template and the function invoked fine before adding IronPDF.
I've tried to manually set the installation directory, but I get a permssion error:
"IronPdf.Installation.TempFolderPath currently set to '/tmp' but has insufficient user permissions for deployment.\nPlease check that this directory exists and full permissions are granted for the current application user"
As far as I know, AWS lambda user has full permissions to "/tmp", but I've never ran a .NET lambda before.
EDIT: I was able to write a text file to /tmp without issue.
public Response Hello(Request request)
{
IronPdf.Installation.TempFolderPath = @"/tmp";
IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
var PDF = Renderer.RenderHtmlAsPdf("<h1>Hello from DocThread</h1>");
PDF.SaveAs("/tmp/sample.pdf");
return new Response("Go Serverless v1.0! Your function executed successfully!", request);
}
Lastly, I imagine that this is just an issue of me being new to C#/.NET on AWS Lambda. It's a fairly common pattern to write files to /tmp before uploading to S3.
Thanks in advance for the help!
I was fighting this issue also, and I just figured it out. Here is what I did:
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ":" + Environment.GetEnvironmentVariable("LAMBDA_TASK_ROOT")); to the constructor for the Lambda.IronPdf.Installation.TempFolderPath = @"/tmp";I also set my MemorySize to 512 and Timeout to 180 in the serverless.template, because I was maxing out on Memory at 256.
I hope this makes sense and helps you solve your issue!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With