Skip to content

brody192/puppeteer-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This example is to be used with the Browserless template

Create a reference variable on your Railway service that you deploy your app to

BROWSER_WS_ENDPOINT=${{Browserless.BROWSER_WS_ENDPOINT}}

Then use process.env.BROWSER_WS_ENDPOINT in code

Before

const browser = await puppeteer.launch();

After

const browser = await puppeteer.connect({ browserWSEndpoint: process.env.BROWSER_WS_ENDPOINT });

The rest of your JS/TS code remains the same with no other changes required.

How to avoid installing Chrome / Chromium (and accompanying dependencies) into your container

  • Switch the puppeteer dependency out for puppeteer-core

    • npm uninstall puppeteer -> npm install puppeteer-core

    • puppeteer-core will not auto install Chrome or Chromium

  • Use this repositories nixpacks.toml file in your project

    • The empty aptPkgs array will prevent Railway from installing the now unwanted Chrome dependencies

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published