Skip to content

Instantly share code, notes, and snippets.

@LidiaKovac
Created May 10, 2024 14:41
Show Gist options
  • Save LidiaKovac/3c3e840b528e495ca8943bdb6a6d0aef to your computer and use it in GitHub Desktop.
Save LidiaKovac/3c3e840b528e495ca8943bdb6a6d0aef to your computer and use it in GitHub Desktop.
AWS EC2 Pupetteer configuration
const browser = await puppeteer.launch({
headless: config.headless,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
ignoreDefaultArgs: ["--disable-extensions"],
})
const page = await this.browser.newPage()
await page.setRequestInterception(true)
page.on("request", (req) => {
if (
req.resourceType() == "stylesheet" ||
req.resourceType() == "font" ||
req.resourceType() == "image"
) {
req.abort()
} else {
req.continue()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment