From e8a0121a12543bba7c9b83ca40747fe90a1c9e02 Mon Sep 17 00:00:00 2001 From: Harold Spencer Jr Date: Wed, 20 Sep 2023 14:04:39 -0700 Subject: [PATCH 1/4] Update Dockerfile Update Nodejs to 18 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4d3469a..2938896 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/lambda/nodejs:16 +FROM public.ecr.aws/lambda/nodejs:18 COPY ./build/ ./ From 6f49065c3fa794c8f07cff38d4f84d4849edfd24 Mon Sep 17 00:00:00 2001 From: Harold Spencer Jr Date: Wed, 20 Sep 2023 14:16:15 -0700 Subject: [PATCH 2/4] Update Makefile Update `install-lambda` to use `public.ecr.aws/sam/build-nodejs18.x` --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d572928..bcaef5f 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ install: npm install install-lambda: - docker run --rm -v $(PWD):/var/task public.ecr.aws/sam/build-nodejs16.x ./build.sh + docker run --rm -v $(PWD):/var/task public.ecr.aws/sam/build-nodejs18.x ./build.sh lite-build: cp -r brave index.js $(TMP_WORKSPACE)/ From 8b502251747ada3ae06f5ad9d8ed1f7c43c8a57e Mon Sep 17 00:00:00 2001 From: Harold Spencer Jr Date: Mon, 25 Sep 2023 12:28:09 -0700 Subject: [PATCH 3/4] Update build.sh to include nss (#99) --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b7c86ff..c2a0b69 100755 --- a/build.sh +++ b/build.sh @@ -3,11 +3,11 @@ # This script runs in the docker container, to set up the rust toolchain # needed to build the adblock-rs node module. -yum install -y openssl-devel; +yum install -y openssl-devel nss; curl https://sh.rustup.rs -sSf > /tmp/sh.rustup.rs; sh /tmp/sh.rustup.rs -y; source ~/.cargo/env; npm config set audit false; npm install; -npm i npm@8 -g; +#npm i npm@8 -g; #npm audit fix; From d2864188991c32ff12328575e0440253496331b5 Mon Sep 17 00:00:00 2001 From: Anton Lazarev <22821309+antonok-edm@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:06:06 -0700 Subject: [PATCH 4/4] migrate to sparticuz/chromium (#102) --- brave/lambda_actions/crawl.js | 6 +++--- package.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/brave/lambda_actions/crawl.js b/brave/lambda_actions/crawl.js index 39d309b..7b5f005 100644 --- a/brave/lambda_actions/crawl.js +++ b/brave/lambda_actions/crawl.js @@ -2,8 +2,8 @@ const urlLib = require('url') -const chromiumLib = require('@sparticuz/chrome-aws-lambda') -const puppeteerLib = chromiumLib.puppeteer +const chromiumLib = require('@sparticuz/chromium') +const puppeteerLib = require('puppeteer-core') const randomJsLib = require('random-js') const tldjsLib = require('tldjs') @@ -304,7 +304,7 @@ const start = async args => { const browser = await puppeteerLib.launch({ args: chromiumLib.args, defaultViewport: chromiumLib.defaultViewport, - executablePath: await chromiumLib.executablePath, + executablePath: await chromiumLib.executablePath(), headless: chromiumLib.headless }) diff --git a/package.json b/package.json index 4531f0a..b077579 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,13 @@ "@aws-sdk/client-lambda": "3.386.0", "@aws-sdk/client-s3": "3.386.0", "@aws-sdk/client-sqs": "3.386.0", - "@sparticuz/chrome-aws-lambda": "^17.1.3", + "@sparticuz/chromium": "^117.0.0", "adblock-rs": "^0.7.18", "fkill": "^6.2.0", "fs-extra": "^8.1.0", "glob": "^7.1.4", "pg": "^8.8.0", - "puppeteer-core": "^17.1.3", + "puppeteer-core": "21.3.4", "random-js": "^2.1.0", "tldjs": "^2.3.1", "uuid": "^3.3.3"