Swizec / lambda-screenshot-as-a-service

AWS Lambda Chrome Headless screenshots
MIT License
147 stars 15 forks source link

Unable to start Chrome #3

Open thecoconutstudio opened 4 years ago

thecoconutstudio commented 4 years ago

Thank you so much for putting together your article. I too have been struggling with all the different examples online. Hopefully your solution will end up working. However I'm getting an Error when navigating to the end point Unable to start Chrome

image

image

vincentcau commented 4 years ago

same problem !

thecoconutstudio commented 4 years ago

I managed to fix this finally. I presumed you cloned the repo like I did.

Instead of using npm install I ran yarn install

I also ran yarn add @serverless-chrome/lambda gm puppeteer-core superagent aws-sdk url yarn add --dev serverless-plugin-chrome

Not sure if it was in that order, but it definitely started me on the right direction. I then had some s3 storage permission issues...

vincentcau commented 4 years ago

I have alway this problem with yarn

"errorMessage": "Unable to start Chrome.

do you change something in the serverless.yml ?

Capture d’écran 2020-02-18 à 23 02 07
michaldolnik commented 4 years ago

I have the same problem ...

image

I think there is also another problem, AWS Lambda does not support node8.10 anymore. Just node12.x ...

fuschini commented 4 years ago

Same here

vincentcau commented 4 years ago

Hi if you want an other solution it work for me with this rep : https://github.com/alixaxel/chrome-aws-lambda

and prebuid the layer like this

#!/bin/bash
set -e
rm -fr chrome-aws-lambda
git clone --depth=1 https://github.com/alixaxel/chrome-aws-lambda.git
cd chrome-aws-lambda
mkdir -p ../chrome-layer 
make ../chrome-layer/chrome_aws_node10x.zip
ls -lah ../chrome-layer/chrome_aws_node10x.zip
rm -fr ../chrome-aws-lambda
echo 'Layer created successfully!'

then use the layer on your serverless.yml (with runtime: nodejs10.x)

layers:
  chromePreBuilt:
    package:
      artifact: chrome-layer/chrome_aws_node10x.zip
thecoconutstudio commented 4 years ago

I have the same problem ...

image

I think there is also another problem, AWS Lambda does not support node8.10 anymore. Just node12.x ...

I did have this same problem, but managed to fix it with the steps above. Also working with "runtime": "nodejs8.10"

fuschini commented 4 years ago

@vincentcau that repo worked for me too straight out of the box!

Swizec commented 4 years ago

Oh hey I totally missed this. This lambda should work now. I had the same issue a few months ago