Puppeteer Problem

need help please, working with puppeteer.
2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] Error: Failed to launch the browser process!

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] /app/.cache/puppeteer/chrome/linux-114.0.5735.133/chrome-linux64/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] TROUBLESHOOTING: Troubleshooting | Puppeteer

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at Interface.onClose (/app/node_modules/@puppeteer/browsers/lib/cjs/launch.js:259:24)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at Interface.emit (node:events:525:35)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at Interface.close (node:internal/readline/interface:533:10)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at Socket.onend (node:internal/readline/interface:259:10)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at Socket.emit (node:events:525:35)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at endReadableNT (node:internal/streams/readable:1359:12)

2023-07-28T16:31:43.063 app[5683d4e6f2568e] mia [info] at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

2023-07-28T16:31:43.064 app[5683d4e6f2568e] mia [info] were here finally

2023-07-28T16:31:43.064 app[5683d4e6f2568e] mia [info] Error: Failed to launch the browser process!

You are likely missing some dependencies in your Dockerfile. Take a look at Puppeteer docs and make sure all the listed required packages are included in your Dockerfile.

1 Like

This is what I currently have in my Dockerfile

FROM debian:bullseye as builder

ARG NODE_VERSION=18.16.0

RUN apt-get update; apt install -y curl python-is-python3 pkg-config build-essential
libasound2
libatk-bridge2.0-0
libatk1.0-0
libatspi2.0-0
libc6
libcairo2
libcups2
libdbus-1-3
libexpat1
libgbm1
libgcc1
libglib2.0-0
libnspr4
libnss3
libpango-1.0-0
libpangocairo-1.0-0
libstdc++6
libuuid1
libx11-6
libx11-xcb1
libxcb-dri3-0
libxcb1
libxcomposite1
libxcursor1
libxdamage1
libxext6
libxfixes3
libxi6
libxkbcommon0
libxrandr2
libxrender1
libxshmfence1
libxss1
libxtst6
libglib2.0-0
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}

#######################################################################

RUN mkdir /app
WORKDIR /app

NPM will not install any package listed in “devDependencies” when NODE_ENV is set to “production”,

to install all modules: “npm install --production=false”.

Ref: npm-install | npm Docs

ENV NODE_ENV production

COPY . .

RUN npm install
FROM debian:bullseye

LABEL fly_launch_runtime=“nodejs”

COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app

WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

CMD [ “npm”, “run”, “start” ]

Change Dockerfile to this:

FROM debian:bullseye as builder

ARG NODE_VERSION=18.16.0

RUN apt-get update && apt-get install -y curl python-is-python3 pkg-config build-essential libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libgbm1 libgcc1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libuuid1 libx11-6 libx11-xcb1 libxcb-dri3-0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1 libxss1 libxtst6 libglib2.0-0

RUN curl https://get.volta.sh | bash

ENV VOLTA_HOME /root/.volta

ENV PATH /root/.volta/bin:$PATH

RUN volta install node@${NODE_VERSION}

RUN mkdir /app

WORKDIR /app

NPM will not install any package listed in “devDependencies” when NODE_ENV is set to “production”,

to install all modules: “npm install --production=false”.

Ref: npm-install | npm Docs

ENV NODE_ENV production

COPY . .

RUN npm install

LABEL fly_launch_runtime=“nodejs”

WORKDIR /app

ENV NODE_ENV production

ENV PATH /root/.volta/bin:$PATH

CMD [ “npm”, “run”, “start” ]

I am now getting a memory issue error though:

2023-07-28T19:43:15.097 app[e2865d40ce6678] mia [info] [ 102.674584] Out of memory: Killed process 342 (chrome) total-vm:1185748340kB, anon-rss:13468kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:488kB oom_score_adj:300

2023-07-28T19:43:35.502 app[5683d4e6f2568e] mia [info] user d/c

2023-07-28T19:43:37.243 app[e2865d40ce6678] mia [info] [ 124.820360] Out of memory: Killed process 341 (chrome) total-vm:1185748336kB, anon-rss:14076kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:524kB oom_score_adj:300

2023-07-28T19:43:38.422 app[5683d4e6f2568e] mia [info] user d/c

2023-07-28T19:43:39.373 app[e2865d40ce6678] mia [info] user d/c

2023-07-28T19:43:39.474 app[e2865d40ce6678] mia [info] user d/c

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] /app/node_modules/puppeteer/node_modules/puppeteer-core/lib/cjs/puppeteer/util/Deferred.js:39

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] this.reject(new Errors_js_1.TimeoutError(opts.message));

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] ^

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] TimeoutError: waiting for target failed: timeout 30000ms exceeded

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] at Timeout. (/app/node_modules/puppeteer/node_modules/puppeteer-core/lib/cjs/puppeteer/util/Deferred.js:39:29)

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] at listOnTimeout (node:internal/timers:569:17)

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] at process.processTimers (node:internal/timers:512:7)

2023-07-28T19:44:00.616 app[e2865d40ce6678] mia [info] Node.js v18.16.0

This definitely got me through my previous error thank you, now have the memory problem. If you have any idea please let me know. Thank you!

Have you tried adding more memory? Chrome is a bit of a hog. fly scale memory · Fly Docs

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.