jweisman / Alma-AWS-Lambda

AWS Lambda functions for Alma
11 stars 5 forks source link

Use created build on AWS Lambda #2

Open abdulbarik opened 6 years ago

abdulbarik commented 6 years ago

Hi, Thanks for giving this awesome module to convert office to pdf. I am using PDFHandler to convert office to pdf. I am following the README to create build and deploy it on AWS Lambda with JAVA 8. I am able to deploy it and integrated it with other lambda function(CreateThumbnail). When I am running the CreateThumbnail lambda I am getting error classnotfound exception, mean I am sure I am not giving the correct class name on AWS Lambda. I am Node.js developer, and have only hands on experience in java. Please update the doc with with handler name and others which required or comment here.

Thanks

jweisman commented 6 years ago

The Java Lambda for PDFHandler should be configured with a handler called com.exlibrisgroup.alma.PdfConverter::handleRequest.

Let me know if that works for you and I'll update the readme.

abdulbarik commented 6 years ago

Hi, Thanks for speedy reply. Yes, I am able to run the app. But I am getting lambda timeout error while using pdfHanlder lambda in CreateThumbnail lamda. PDFHanfler taking more than 5 minutes to convert the doc to pdf, mean not getting success response.

Please see the image here:

office

jweisman commented 6 years ago

Glad to hear you're able to run the app.

I performed a test using the AWS Lambda Console. My test function payload looked like this:

{
    "bucket": "na-st01.ext.exlibrisgroup.com", 
    "key": "TR_INTEGRATION_INST/scratch/Ex Libris Marketplace-Requirements.pptx",
    "destination": "TR_INTEGRATION_INST/scratch/pdf/"
} 

It ran successfully- see the output below. screenshot-console aws amazon com-2018-07-01-12-43-35

I would try to run it from there to isolate other issues.

Good luck!

abdulbarik commented 6 years ago

Thanks a lot for response and updating the doc. I have followed same example and tried to run it, still getting same error. I have doubt in my payload destination value. Where is the TR_INTEGRATION_INST/scratch/pdf/ pathi exists? do I need to create or it created self by PDFHanlder? I tried with your payload destination value with my bucket and key value:

var lambda = new AWS.Lambda();
     var params = {
          FunctionName: 'officetopdfthumbnail', 
     InvocationType: 'RequestResponse',
    Payload: JSON.stringify({ 
       bucket: bucket, 
       key: srcKey,
       destination: "TR_INTEGRATION_INST/scratch/pdf/"
   })
} 

And on my officetopdfthumbnail log, I am getting following error:

image

jweisman commented 6 years ago

The destination is a location within your bucket that you wish to place the resulting PDF file.

From the error message it looks like it can't read your MS Word file. I would try other files to confirm this is the case.