From 636fa64bfa9dcc33bec8b16f2e21a945fc54ce3e Mon Sep 17 00:00:00 2001 From: Kyle McNally Date: Mon, 15 Apr 2024 11:30:16 -0400 Subject: [PATCH] BREAKING!!! Require the user to specify the headless type --- _/amazon/handlers/index.js | 3 ++- source/index.ts | 37 ------------------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/_/amazon/handlers/index.js b/_/amazon/handlers/index.js index 1b6391e..b693f54 100644 --- a/_/amazon/handlers/index.js +++ b/_/amazon/handlers/index.js @@ -10,11 +10,12 @@ exports.handler = async (event, context) => { browser = await puppeteer.launch({ args: puppeteer.defaultArgs({ args: chromium.args, + headless: "shell", }), defaultViewport: chromium.defaultViewport, dumpio: true, executablePath: await chromium.executablePath(), - headless: chromium.headless, + headless: "shell", ignoreHTTPSErrors: true, }); diff --git a/source/index.ts b/source/index.ts index 562643e..793d4c2 100644 --- a/source/index.ts +++ b/source/index.ts @@ -88,13 +88,6 @@ if (isRunningInAwsLambdaNode20()) { } class Chromium { - /** - * Determines the headless mode that chromium will run at - * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless - * @values true or "new" - */ - private static headlessMode: true | "shell" = "shell"; - /** * If true, the graphics stack and webgl is enabled, * If false, webgl will be disabled. @@ -299,36 +292,6 @@ class Chromium { return result.shift() as string; } - /** - * Returns the headless mode. - * "shell" means the 'old' (legacy, chromium < 112) headless mode. - * `true` means the 'new' headless mode. - * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless - * @returns true | "shell" - */ - public static get headless() { - return this.headlessMode; - } - - /** - * Sets the headless mode. - * "shell" means the 'old' (legacy, chromium < 112) headless mode. - * `true` means the 'new' headless mode. - * https://developer.chrome.com/articles/new-headless/#try-out-the-new-headless - * @default "shell" - */ - public static set setHeadlessMode(value: true | "shell") { - if ( - (typeof value === "string" && value !== "shell") || - (typeof value === "boolean" && value !== true) - ) { - throw new Error( - `Headless mode must be either \`true\` or 'shell', you entered '${value}'` - ); - } - this.headlessMode = value; - } - /** * Returns whether the graphics stack is enabled or disabled * @returns boolean