puppeteer install in railway container

I am trying to run a node script using bun and puppeteer but the container fails to retrieve the chrome executable
$ bun src/index.ts

283 | if (this.puppeteer.configuration.browserRevision) {

284 | throw new Error(`Tried to find the browser at the configured path (${executablePath}) for revision ${this.puppeteer.browserRevision}, but no executable was found.`);

285 | }

286 | switch (this.product) {

287 | case 'chrome':

288 | throw new Error(`Could not find Chrome (ver. ${this.puppeteer.browserRevision}). This can occur if either\n` +

^

error: Could not find Chrome (ver. 119.0.6045.105). This can occur if either

1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or

2. your cache path is incorrectly configured (which is: /root/.cache/puppeteer).

For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

at resolveExecutablePath (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:288:26)

at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:113:31

at computeLaunchArguments (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:72:33)

at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:79:33

at launch (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:77:17)

at /app/node_modules/puppeteer-extra/dist/index.cjs.js:128:30

at processTicksAndRejections (:61:76)
$ bun src/index.ts

283 | if (this.puppeteer.configuration.browserRevision) {

284 | throw new Error(`Tried to find the browser at the configured path (${executablePath}) for revision ${this.puppeteer.browserRevision}, but no executable was found.`);

285 | }

286 | switch (this.product) {

287 | case 'chrome':

288 | throw new Error(`Could not find Chrome (ver. ${this.puppeteer.browserRevision}). This can occur if either\n` +

^

error: Could not find Chrome (ver. 119.0.6045.105). This can occur if either

1. you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or

2. your cache path is incorrectly configured (which is: /root/.cache/puppeteer).

For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

at resolveExecutablePath (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:288:26)

at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:113:31

at computeLaunchArguments (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:72:33)

at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:79:33

at launch (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:77:17)

at /app/node_modules/puppeteer-extra/dist/index.cjs.js:128:30

at processTicksAndRejections (:61:76)
8 Replies
Percy
Percy4mo ago
Project ID: 3bcf5308-03ce-40e9-b19a-bff7879f04f7
Lebron James
Lebron James4mo ago
3bcf5308-03ce-40e9-b19a-bff7879f04f7 Not sure if the chromium instance is being installed elsewhere or where it would be inside the railway container
Brody
Brody4mo ago
you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`)
you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`)
Lebron James
Lebron James4mo ago
@Brody railway should be running the puppeteer install command on build no? should I be setting that as the overrided build command
Brody
Brody4mo ago
railway runs your code as-is, its up to you to set the needed commands
Lebron James
Lebron James4mo ago
got it
Brody
Brody4mo ago
you would likely want to set that command in a new build phase https://nixpacks.com/docs/guides/configuring-builds#new-phase (not the build command)
Lebron James
Lebron James4mo ago
Thank you Brody