only add the al2023 stuff on node 20
This commit is contained in:
parent
b6817b6bac
commit
28b086cee9
Binary file not shown.
BIN
bin/aws.tar.br
BIN
bin/aws.tar.br
Binary file not shown.
|
|
@ -4,6 +4,7 @@ import { tmpdir } from "node:os";
|
|||
import { extract } from "tar-fs";
|
||||
import { parse } from "node:url";
|
||||
import type { UrlWithStringQuery } from "node:url";
|
||||
import { version } from "node:process";
|
||||
|
||||
interface FollowRedirOptions extends UrlWithStringQuery {
|
||||
maxBodyLength: number;
|
||||
|
|
@ -38,6 +39,13 @@ export const isRunningInAwsLambda = () => {
|
|||
return false;
|
||||
};
|
||||
|
||||
export const isRunningInAwsLambdaNode20 = () => {
|
||||
if (version.startsWith("v20")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const downloadAndExtract = async (url: string) =>
|
||||
new Promise<string>((resolve, reject) => {
|
||||
const getOptions = parse(url) as FollowRedirOptions;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ import { https } from "follow-redirects";
|
|||
import LambdaFS from "./lambdafs";
|
||||
import { join } from "node:path";
|
||||
import { URL } from "node:url";
|
||||
import { downloadAndExtract, isRunningInAwsLambda, isValidUrl } from "./helper";
|
||||
import {
|
||||
downloadAndExtract,
|
||||
isRunningInAwsLambda,
|
||||
isValidUrl,
|
||||
isRunningInAwsLambdaNode20,
|
||||
} from "./helper";
|
||||
|
||||
/** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */
|
||||
interface Viewport {
|
||||
|
|
@ -308,6 +313,9 @@ class Chromium {
|
|||
if (isRunningInAwsLambda()) {
|
||||
// If running in AWS Lambda, extract more required files
|
||||
promises.push(LambdaFS.inflate(`${input}/aws.tar.br`));
|
||||
if (isRunningInAwsLambdaNode20()) {
|
||||
promises.push(LambdaFS.inflate(`${input}/al.2023.tar.br`));
|
||||
}
|
||||
}
|
||||
|
||||
// Await all extractions
|
||||
|
|
|
|||
Loading…
Reference in New Issue