Convert PS to PDF in AWS Lambda via Aspose.Page for Java - Exception java.io.FileNotFoundException

Trying to run Aspose Eps to convert a PS to PDF in AWS lambda
where the files are running on a read-only directory named /var/task
and the only writable folder is /tmp

This is the exception:

Input file:/tmp/input.eps

17:32:58
Output file:/tmp/9dcc8423-3eb6-4592-965b-9954b2f833c4.pdf

17:32:58
java.lang.RuntimeException: java.io.FileNotFoundException: /var/task (Is a directory) at com.aspose.eps.internal.ll.Il.lI(Unknown Source) at com.aspose.eps.internal.ll.Il.lif(Unknown Source) at com.aspose.eps.internal.ll.Il.l0I(Unknown Source) at com.aspose.eps.AbstractPsConverter.lif(Unknown Source) at com.aspose.eps.Ps2PdfConverter.lif(Unknown Source) at com.aspose.eps.Ps2PdfConverter.conv
java.lang.RuntimeException: java.io.FileNotFoundException: /var/task (Is a directory)
at com.aspose.eps.internal.ll.Il.lI(Unknown Source)
at com.aspose.eps.internal.ll.Il.lif(Unknown Source)
at com.aspose.eps.internal.ll.Il.l0I(Unknown Source)
at com.aspose.eps.AbstractPsConverter.lif(Unknown Source)
at com.aspose.eps.Ps2PdfConverter.lif(Unknown Source)
at com.aspose.eps.Ps2PdfConverter.convertToPdf(Unknown Source)
at com.csdisco.postscriptprocess.ConvertToPdfHandler.convert(ConvertToPdfHandler.java:44)
at com.csdisco.postscriptprocess.Handler.handleRequest(Handler.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:259)
at lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:178)
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:293)
at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:114)
Caused by: java.io.FileNotFoundException: /var/task (Is a directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at com.aspose.eps.internal.l421.II.lif(Unknown Source)
at com.aspose.eps.internal.l0l.I11.l0iF(Unknown Source)

The code is from your sample:

      System.out.println("Input file:"+ fileName);
        System.out.println("Output file:"+ tempFileName);

        FileInputStream psStream = new FileInputStream(fileName);
        FileOutputStream pdfStream = new FileOutputStream( tempFileName);
        // If you want to convert Postscript file despite of minor errors set this flag
        Boolean suppressErrors = true;

        Ps2PdfConverterOptions options = new Ps2PdfConverterOptions(psStream, pdfStream, suppressErrors);

        // Set page size
        options.setPageSize(new Dimension(595, 842));

        // If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
        //options.setFontsFolders(new String[] { "{FONT_FOLDER}" });
        try
        {
            Ps2PdfConverter converter = new Ps2PdfConverter();
            converter.convertToPdf(options);
        }
        finally
        {
            psStream.close();
            pdfStream.close();
        }
        
        //Review errors
        if (suppressErrors)
        {
            for (PsConverterException ex : options.getExceptions()) {
                System.out.println(ex.getMessage());
            }
        }

Also using your input sample file in the resources folder of GitHub Repository:

Did not receive a response and I do not see this in the list of my submitted issue
wondering if there was a problem filing this issue

@russ.nichols

First of all, please accept our humble apology for delayed response. We have surely logged an issue as EPSJAVA-54 in our issue tracking system for further investigation. We will look into details of it and will surely inform you as soon as additional updates are available regarding its rectification. Please spare us little time.

We are sorry for the inconvenience.

@russ.nichols

We have started investigation against your issue. However, we have noticed that exception you shared was related to input.eps file whereas the file you referred as sample to test - it was input.ps (present on GitHub Repository). Would you please share the input.eps file that you actually have used at your side.

In AWS lambda it fails with 100% of the ps or eps files … so you can use any file to reproduce this issue

@russ.nichols

Thanks for the confirmation. We will continue investigation and let you know in case of further updates.

@russ.nichols

We need additional information from you in order to proceed with further investigation:

  1. In which directory Aspose.Page library .jar is located.
  2. In which directory test class or .jar is located.

In AWS Lambda we need to provide a shaded JAR.
AWS Lambda then unzips the JAR and places all the extracted classes in the /var/task
folder.
So there is no longer a JAR file for the aspose page library, but all the com.aspose classes
are extracted in the com aspose subfolder of /var/task

@russ.nichols

Thanks for providing these details.

We will get back to you as soon as additional updates are available.