-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update chromium and node #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ | |
.idea/* | ||
|
||
.DS_Store | ||
.yarn | ||
coverage | ||
*.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
coverage | ||
*.log | ||
.gitlab-ci.yml | ||
.yarn | ||
|
||
yarn.lock | ||
/*.tgz | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,14 +42,15 @@ | |
"dependencies": { | ||
"@aws-sdk/client-s3": "^3.56.0", | ||
"@aws-sdk/s3-request-presigner": "^3.120.0", | ||
"chrome-aws-lambda": "^10.1.0", | ||
"@sparticuz/chromium": "122", | ||
"puppeteer-core": "^13.5.1", | ||
"puppeteer-report": "^3.0.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"volta": { | ||
"node": "14.19.1" | ||
"node": "18.16.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, should use node 20 |
||
"yarn": "3.6.4" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import chromium from 'chrome-aws-lambda'; | ||
import { PDFOptions } from 'puppeteer-core'; | ||
import puppeteer, { PDFOptions } from 'puppeteer-core'; | ||
import report from 'puppeteer-report'; | ||
|
||
import chromium from '@sparticuz/chromium'; | ||
|
||
import PdfGenerationRequest from '../requests/request'; | ||
|
||
const DEFAULT_PRINT_OPTIONS: PDFOptions = { | ||
|
@@ -29,7 +30,7 @@ | |
}); | ||
console.log(`Puppeteer visited page located at ${pdfGenerationRequest.url}`); | ||
const options = { ...htmlToPdfPrintOptions, ...pdfGenerationRequest.pdfOptions }; | ||
await report.pdfPage(page, { | ||
await report.pdfPage(page as any, { | ||
path: pdfGenerationRequest.localFilePath, | ||
...options | ||
}); | ||
|
@@ -40,13 +41,14 @@ | |
} | ||
|
||
async launchBrowser(pdfGenerationRequest: PdfGenerationRequest) { | ||
return await chromium.puppeteer.launch({ | ||
const chromiumPath = await chromium.executablePath(); | ||
const options = { | ||
args: chromium.args, | ||
defaultViewport: null, | ||
executablePath: await chromium.executablePath, | ||
headless: chromium.headless, | ||
ignoreHTTPSErrors: true, | ||
executablePath: chromiumPath, | ||
headless: !!process?.env?.BROWSER_HEADLESS === false ? false : true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably should follow what the spazium lib does: https://github.com/Sparticuz/chromium?tab=readme-ov-file#usage and use |
||
...pdfGenerationRequest.browserOptions | ||
}); | ||
}; | ||
|
||
return await puppeteer.launch(options); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should upgrade to use 20