highcharts / node-export-server

Highcharts Node.js export server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems running on AWS Lambda

davidnoah opened this issue · comments

LOGS:
Error: write EPIPE
at exports._errnoException (util.js:1018:11)
at WriteWrap.afterWrite (net.js:800:14)

I am building a script that dynamically generates an email and also includes a highchart. This script will run as a lambda function for a massive amount of emails, although it seems to fail when I run the node-export-server "export" function. Any idea why this happens? And if so, how can I fix this?

A duplicate of #42

@davidnoah - by any chance are you using a Mac to deploy to Lambda?

I was. And that was the problem. After switching to Linux (for packaging the Lambda deployment package, probably npm install is the most relevant here) it worked.

I guess the problem is of some native libraries which one of the dependencies (phantompool?) brings. When deploying from OSX we might be trying to push OSX binaries to AWS Lambda (which is Linux-based).

Thanks for posting an update on this @mccartney.

That makes a lot of sense - we use the phantom-prebuilt package, so if the deployment scripts use the local node modules, you'll end up with a macos build of phantom.js.

Indeed, PhantomJS is by default compiled for the platform where npm install is ran.

PhantomJS addresses this issue on the GitHub README.md here.

For me setting the environment variables to:

PHANTOMJS_PLATFORM="linux"
PHANTOMJS_ARCH="x64"

fixed the issue as I was running phantomjs on AWS Lambda (linux x64) but compiling it on MacOS.

Still experiencing this issue for Node 10.x on AWS Lambda, but not on Node 8.x

Still experiencing this issue for Node 10.x,12.x on AWS Lambda

@saurabhjindalFMQ are you using Mac to build the Lambda?

@mccartney I'm using aws codebuild which uses liunx to build the packages. I have tried to build on my local machine linux also but it is not working

OK. Then I don't know. My issue was different.