Serverless-chrome: running on aws I get {"message": "Internal server error"}

Created on 3 Dec 2018  ·  7Comments  ·  Source: adieuadieu/serverless-chrome

Followed all instructions. Can't run locally or on aws.

On aws, I simply get:

{"message": "Internal server error"}

for either pdf or version-info (didn't test the others)

Locally I get:

"errorMessage": "Unable to start Chrome. If you have the DEBUG env variable set,there will be more in the logs.",

Couldn't find a solution in any of the issues related to this.

Most helpful comment

Try to comment/remove DEBUG: "*" from serverless.yml
Worked for me.

All 7 comments

I had the same problem. Did you get any further ?

Looking at the logs I can see this message too

Error trying to spawn chrome: { Error: connect ECONNREFUSED 127.0.0.1:9222

You guys did not deploy from Windows, right? That's a common issue.

No, I am on a mac

Try to comment/remove DEBUG: "*" from serverless.yml
Worked for me.

I removed debug re-deployed to AWS and still have issues especially with larger html pages with the pdf endpoint.

The issue I have is sometimes it renders other times it does not and I simple get internal server error

From the api gateway logs I can see the below

keep getting
Tue Apr 16 19:04:20 UTC 2019 : Endpoint response headers: {Date=Tue, 16 Apr 2019 19:04:20 GMT, Content-Type=application/json, Content-Length=254, Connection=keep-alive, x-amzn-RequestId=a4673cc9-d597-466f-98e4-ee505b608b48, X-Amz-Function-Error=Handled, x-amzn-Remapped-Content-Length=0, X-Amz-Executed-Version=$LATEST, X-Amzn-Trace-Id=root=1-5cb62734-8b5839474d6dc0f6783e9603;sampled=0} Tue Apr 16 19:04:20 UTC 2019 : Endpoint response body before transformations: {"errorMessage":"connect ECONNREFUSED 127.0.0.1:9222","errorType":"Error","stackTrace":["Object.exports._errnoException (util.js:1018:11)","exports._exceptionWithHostPort (util.js:1041:20)","TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)"]} Tue Apr 16 19:04:20 UTC 2019 : Lambda execution failed with status 200 due to customer function error: connect ECONNREFUSED 127.0.0.1:9222. Lambda request id: a4673cc9-d597-466f-98e4-ee505b608b48 Tue Apr 16 19:04:20 UTC 2019 : Method completed with status: 502

my understanding of this is

api gateway endpoint -> lambda function -> call to chrome

The call to chrome bit breaks. Any ideas on how to debug this?

I've tried the above

  1. remove DEBUG: "*" from serverless.yml

I made some progress on this. After looking at
https://github.com/adieuadieu/serverless-chrome/issues/185
I noticed in the package.json here
https://github.com/adieuadieu/serverless-chrome/blob/master/examples/serverless-framework/aws/package.json#L12-L13

the channel for chromium was dev so changed it to stable.

Now I'm getting a different error 🤦‍♂️ I think its related to the size of the html I am trying to convert to pdf

Tue Apr 16 19:40:00 UTC 2019 : Sending request to https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:723362941768:function:aws-dev-pdf/invocations Tue Apr 16 19:40:04 UTC 2019 : Received response. Status: 200, Integration latency: 4558 ms Tue Apr 16 19:40:04 UTC 2019 : Endpoint response headers: {Date=Tue, 16 Apr 2019 19:40:04 GMT, Content-Type=application/json, Content-Length=4, Connection=keep-alive, x-amzn-RequestId=4432db0d-2217-4680-9634-306d20b8c421, x-amzn-Remapped-Content-Length=0, X-Amz-Executed-Version=$LATEST, X-Amzn-Trace-Id=root=1-5cb62f90-c9a98afc30822e2807c7c54e;sampled=0} Tue Apr 16 19:40:04 UTC 2019 : Endpoint response body before transformations: null Tue Apr 16 19:40:04 UTC 2019 : Execution failed due to configuration error: Malformed Lambda proxy response Tue Apr 16 19:40:04 UTC 2019 : Method completed with status: 502

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alekseykulikov picture alekseykulikov  ·  4Comments

t-io picture t-io  ·  8Comments

davewingate picture davewingate  ·  10Comments

adieuadieu picture adieuadieu  ·  11Comments

jonhkr picture jonhkr  ·  9Comments