Skip to content

justengland/phantomjs-lambda-pack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhantomJS wrapper for AWS Lambda

Simplify the usage of PhantomJS on AWS Lambda

$ npm install phantomjs-lambda-pack --save

Usage

'use strict';
const phantomjsLambdaPack = require('phantomjs-lambda-pack');
const exec = phantomjsLambdaPack.exec;

exports.handler = (event, context, callback) => {
    exec('-v', (error, stdout, stderr) => {
        if (error) {
            console.error(`exec error: ${error}`);
            return;
        }

        console.log(`phantom version: ${stdout}`);
        console.log(`Should have no error: ${stderr}`);

        callback(error, 'fin!!');
    });
};

To Do

  1. Support phantomjs versioning, currently it just uses the latest of phatomjs-prebuilt
  2. Better support in the local environments, currently phantomjs needs to be installed in the path
  3. Check if the lambda memory requirements are met.

Notes

Use more memory at least 1024 and a timeout greater than 180 seconds Make sure to zip up the entire directory and ship it

Example

Basic Version Check using Serverless

Thanks

PhantomJS

AWS Lambda

PhantomJS-Prebuilt

Serverless

About

An NPM module used to integrate PhantomJS and AWS Lambda

Resources

Stars

Watchers

Forks

Packages

No packages published