Skip to content

Commit

Permalink
try another lambda chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyek committed Jun 12, 2024
1 parent ad73fe9 commit b77b00e
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 7 deletions.
153 changes: 150 additions & 3 deletions projects/scrape-txs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions projects/scrape-txs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.596.0",
"@sparticuz/chromium": "^123.0.1",
"commander": "^12.0.0",
"dayjs": "~1.11.10",
"decimal.js": "^10.4.3",
Expand Down
8 changes: 5 additions & 3 deletions projects/scrape-txs/src/lib/run.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
import type dayjs from 'dayjs';
import fs from 'node:fs/promises';
import { chromium, errors as playwrightErrors, type Browser } from 'playwright';
import { launchChromium } from 'playwright-aws-lambda';
import { chromium, type Browser } from 'playwright';
import lambdaChromium from '@sparticuz/chromium';
import { z } from 'zod';
import { bacGtScrape } from './bac-gt/scrape';
import { bancoIndustrialScrape } from './banco-industrial/scrape';
Expand All @@ -20,7 +20,9 @@ export async function run(months: dayjs.Dayjs[]) {
z.enum(['bancoIndustrialGt', 'bacGt'] as const).parse(process.env.BANK_KEY);

const browser = isLambda()
? ((await launchChromium({
? ((await chromium.launch({
args: lambdaChromium.args,
executablePath: await lambdaChromium.executablePath(),
headless: true,
})) as Browser)
: await chromium.launch({
Expand Down
4 changes: 3 additions & 1 deletion projects/scrape-txs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

"allowSyntheticDefaultImports": true

// Some stricter flags
// "noUnusedLocals": true,
Expand Down

0 comments on commit b77b00e

Please sign in to comment.