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
const browser = await puppeteer.launch();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.
-
Switch the
puppeteerdependency out forpuppeteer-core-
npm uninstall puppeteer->npm install puppeteer-core -
puppeteer-corewill not auto install Chrome or Chromium
-
-
Use this repositories
nixpacks.tomlfile in your project- The empty
aptPkgsarray will prevent Railway from installing the now unwanted Chrome dependencies
- The empty