Giter Site home page Giter Site logo

jpaolin / aws-lambda-s3-wkhtmltopdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jblotus/aws-lambda-wkhtmltopdf

27.0 27.0 6.0 42.88 MB

Convert HTML to PDF using Webkit (QtWebKit) on AWS Lambda

JavaScript 100.00%
aws aws-lambda html-to-pdf lambda s3 wkhtmltodf

aws-lambda-s3-wkhtmltopdf's People

Contributors

jpaolin avatar lubos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-lambda-s3-wkhtmltopdf's Issues

Does not handle multi-record events

The code does not handle multi-record events. Instead it only processes the first record.
There is potential here for missed events.

	const region = event.Records[0].awsRegion;
	const bucket = event.Records[0].s3.bucket.name;
	const key = event.Records[0].s3.object.key;

Exit with code 1 due to network error: ContentNotFoundError

Hi,

I'm trying to get your lamda solution working and I have run into the following error.

REPORT RequestId: 21cd60a4-8986-11e7-93ce-9ff610186b10	Duration: 2159.54 ms	Billed Duration: 2200 ms Memory Size: 128 MB	Max Memory Used: 40 MB

11:12:33
START RequestId: 21cd60a4-8986-11e7-93ce-9ff610186b10 Version: $LATEST
START RequestId: 21cd60a4-8986-11e7-93ce-9ff610186b10 Version: $LATEST

11:12:33
2017-08-25T11:12:33.067Z	21cd60a4-8986-11e7-93ce-9ff610186b10	Invocation state = { "region": "eu-west-1", "bucket": "BUCKETNAME", "key": "htmltopdf/template.html", "input_filename": "htmltopdf/template.html", "output_filename": "htmltopdf/template.pdf" }

11:12:33
2017-08-25T11:12:33.067Z	21cd60a4-8986-11e7-93ce-9ff610186b10	Generating PDF for http://BUCKETNAME.s3-website-eu-west-1.amazonaws.com/htmltopdf/template.html

11:12:34
2017-08-25T11:12:34.504Z	21cd60a4-8986-11e7-93ce-9ff610186b10	wkhtmltopdf failed!

11:12:34
2017-08-25T11:12:34.505Z	21cd60a4-8986-11e7-93ce-9ff610186b10	{"errorMessage":"Exit with code 1 due to network error: ContentNotFoundError\n\nwkhtmltopdf exited with code 1","errorType":"Error","stackTrace":["","wkhtmltopdf exited with code 1","handleError (/var/task/node_modules/wkhtmltopdf/index.js:142:16)","ChildProcess.<anonymous> (/var/task/node_modules/wkhtmltopdf/index.js:114:7)","emitTwo (
2017-08-25T11:12:34.505Z	21cd60a4-8986-11e7-93ce-9ff610186b10
{
    "errorMessage": "Exit with code 1 due to network error: ContentNotFoundError\n\nwkhtmltopdf exited with code 1",
    "errorType": "Error",
    "stackTrace": [
        "",
        "wkhtmltopdf exited with code 1",
        "handleError (/var/task/node_modules/wkhtmltopdf/index.js:142:16)",
        "ChildProcess.<anonymous> (/var/task/node_modules/wkhtmltopdf/index.js:114:7)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)"
    ]
}```

I'm assuming that I maybe forgot a role or something but looking at it it looks correct.

Any ideas?

Thanks

Exit with code 127

Hi,

I tried this package and modify it a little bit (to use static url instead of s3 url).
But I get following error:

{ "errorMessage": "/bin/bash: wkhtmltopdf: command not found\n\nwkhtmltopdf exited with code 127", "errorType": "Error", "stackTrace": [ "", "wkhtmltopdf exited with code 127", "handleError (/var/task/node_modules/wkhtmltopdf/index.js:142:16)", "ChildProcess.<anonymous> (/var/task/node_modules/wkhtmltopdf/index.js:114:7)", "emitTwo (events.js:126:13)", "ChildProcess.emit (events.js:214:7)", "Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)" ] }

What this error code mean?

wkhtmltoimage

Hi,

I am trying to build the wkhtmltoimage in order to use the corresponding wkhtmltoimage binary that will function on Amazon Linux AMI and I am having trouble. I was hoping you could provide the one that was built when creating the wkhtmltopdf binary found the the repo!

Thanks,
Nathan

Enable S3 event fanout using SNS

A legitimate case could be made around fanning out S3 events using SNS, with the Lambda function as one of the subscribers. We would have to handle both S3 and SNS events as potential triggers.

Example S3 event

{  
   "Records":[  
      {  
         "eventVersion":"2.0",
         "eventSource":"aws:s3",
         "awsRegion":"us-east-1",
         "eventTime":"1970-01-01T00:00:00.000Z",
         "eventName":"ObjectCreated:Put",
         "userIdentity":{  
            "principalId":"AIDAJDPLRKLG7UEXAMPLE"
         },
         "requestParameters":{  
            "sourceIPAddress":"127.0.0.1"
         },
         "responseElements":{  
            "x-amz-request-id":"C3D13FE58DE4C810",
            "x-amz-id-2":"FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD"
         },
         "s3":{  
            "s3SchemaVersion":"1.0",
            "configurationId":"testConfigRule",
            "bucket":{  
               "name":"mybucket",
               "ownerIdentity":{  
                  "principalId":"A3NL1KOZZKExample"
               },
               "arn":"arn:aws:s3:::mybucket"
            },
            "object":{  
               "key":"HappyFace.jpg",
               "size":1024,
               "eTag":"d41d8cd98f00b204e9800998ecf8427e",
               "versionId":"096fKKXTRTtl3on89fVO.nfljtsv6qko",
               "sequencer":"0055AED6DCD90281E5"
            }
         }
      }
   ]
}

Example SNS event

{
  "Records": [
    {
      "EventVersion": "1.0",
      "EventSubscriptionArn": "arn:aws:sns:EXAMPLE",
      "EventSource": "aws:sns",
      "Sns": {
        "SignatureVersion": "1",
        "Timestamp": "1970-01-01T00:00:00.000Z",
        "Signature": "EXAMPLE",
        "SigningCertUrl": "EXAMPLE",
        "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e",
        "Message": "Hello from SNS!",
        "MessageAttributes": {
          "Test": {
            "Type": "String",
            "Value": "TestString"
          },
          "TestBinary": {
            "Type": "Binary",
            "Value": "TestBinary"
          }
        },
        "Type": "Notification",
        "UnsubscribeUrl": "EXAMPLE",
        "TopicArn": "arn:aws:sns:EXAMPLE",
        "Subject": "TestInvoke"
      }
    }
  ]
}

aws lambda nodejs12.x not working

When I transfert the code to nodejs12.x its doesn't work anymore saying :

libXrender.so.1: cannot open shared object file.

wkhtmltopdf was working on Node.js 8.10 but I had to transfert it to nodejs12.x because Node.js 8.10 will not be supported anymore by aws.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.