-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chrome-aws-lambda changes (node10.x support) #15
Comments
That shouldn't be the case, the overload of only adds helper methods on top of puppeteer. Also, there's a make target to generate a well structured Lambda Layer. |
Let me describe the steps I am using now. I sure am missing something here. You should be able to help me along. My deployed program does not have a direct dependency on 'chrome-aws-lambda' package. Loading of all required components I am doing using a layer and puppeteer-core. let getBrowser = async()=>{
let puppeteer = null;
let chromePath = fs.existsSync('/opt/headless_shell') ? '/opt/headless_shell' : null;
if(!chromePath){
chromePath = fs.existsSync('layer/headless_shell') ? 'layer/headless_shell' : null;
}
let options = {
headless: true,
args: ['--no-sandbox', '--disable-gpu', '--single-process'],
};
console.dir(options)
if(chromePath){
puppeteer = require('puppeteer-core');;
options.executablePath = chromePath
}
else{
puppeteer = require('puppeteer');
options={};
}
return puppeteer.launch(options);
} I am using a build script on this project to create a packaged chrome executable for chrome. #!/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 && \
brotli --decompress --rm bin/chromium*.br && \
npm pack && \
mkdir -p nodejs/node_modules/chrome-aws-lambda/ && \
tar --directory nodejs/node_modules/chrome-aws-lambda/ --extract --file chrome-aws-lambda-*.tgz --strip-components=1 && \
rm chrome-aws-lambda-*.tgz
find bin -name "chromium*" -exec mv {} ../layer/headless_shell \;
chmod 755 ../layer/headless_shell
echo 'Layer created successfully!' With @alixaxel 's 1.20.3 code the above scripts build a nice package that I can use w/o any problem with puppeteer-core and node8.10 AWS runtime. To create additional library components, I used @alixaxel 's make file to create chrome10.zip into my 'layer' folder. %.zip:
mkdir -p nodejs/node_modules/chrome-aws-lambda/
cd nodejs/ && npm install lambdafs@~1.3.0 puppeteer-core@~1.20.0 --no-bin-links --no-optional --no-package-lock --no-save --no-shrinkwrap && cd -
npm pack
tar --directory nodejs/node_modules/chrome-aws-lambda/ --extract --file chrome-aws-lambda-*.tgz --strip-components=1
rm chrome-aws-lambda-*.tgz
mkdir -p $(dir $@)
zip -9 --filesync --move --recurse-paths $@ nodejs/ With this step, my layer/ folder now has two files. /layer/headless_shell When I deploy this combined layer with Node 10 AWS Runtime, puppeteer is unable to map Library paths. It is unable to load chrome and errors out with the following message.
|
I have submitted a PR with Node 10 compatibility. |
I ran into the same issue just now, and updated my script with the new build script that @devasur created in #16. It works for me, and I've updated my script to utilize the new layer created as well. |
Hit this today, node8 is deprecated. |
Now node10 is deprecated. I'm facing this error
I'm trying to figure out how to work with newer node versions. |
AWS is removing the Node 8.10 support. In connection with this @alixaxel has updated the https://github.com/alixaxel/chrome-aws-lambda to support Node 10. He is packaging a few required dependencies in the /bin folder. Also the naming convention for chromium build has changed. As you can see the download script needs corresponding fixes.
alixaxel/chrome-aws-lambda#37
One pickle with here is that @alixaxel's fix is not working nice with puppeteer-core. It needs a specific instantiation through its library for puppeteer.
This in all is currently braking your example with Node 10. Giving you a heads up. I will also try to find a working model and if I do will do a PR. Might be faster for you.
The text was updated successfully, but these errors were encountered: