David Zaba
David Zaba

Reputation: 67

puppeteer - centos7 - symbol not found

Hi I have a super simple Dockerfile to run puppeteer in Docker:

FROM node:12.2.0-alpine

RUN apk update && apk upgrade && \
  echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
  echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
  apk add --no-cache \
  bash=4.4.19-r1 \
  git=2.20.1-r0 \
  openssh=7.9_p1-r5 \
  chromium@edge \
  nss@edge \
  freetype@edge \
  harfbuzz@edge \
  ttf-freefont@edge \
  sudo=1.8.25_p1-r2

ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
ENTRYPOINT ["dumb-init", "--"]

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

WORKDIR /app

COPY package.json .

RUN npm install --quiet -g pm2@^3.5.1 && \
    npm install [email protected] && \
    npm install --quiet

COPY app.js ./app.js

RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \
  && mkdir -p /home/pptruser/Downloads \
  && chown -R pptruser:pptruser /home/pptruser \
  && chown -R pptruser:pptruser /app

USER pptruser

EXPOSE 1337

CMD [ "pm2-runtime", \
    "start", "app.js", \
    "-i", "max", \
    "--max-memory-restart", "1700M", \
    "--cron", "0 */12 * * *" \
]

This was a working solution until now wehn I have run yum update on my centos7 host machine. Right after that, the app refuses to work properly generating the following error:

Error: LAUNCH_BROWSER
    at /app/node_modules/async/dist/async.js:171:65
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Error: Failed to launch chrome!
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt7__cxx1119basic_ostringstreamIcSt11char_traitsIcESaIcEEC1Ev: symbol not found
Error relocating /usr/lib/chromium/chrome: _ZNSt19_Sp_make_shared_tag5_S_eqERKSt9type_info: symbol not found

I have failed to find a solution so far to put it back in order :-( Any advice appreciated.

Upvotes: 3

Views: 1413

Answers (1)

Thomas Dondorf
Thomas Dondorf

Reputation: 25230

There is currently a problem with the recent Chromium version on alpine. See these two issues on github for more information:

Solution

The solution for now is to downgrade the Chromium version to version 72. Some users also reported that version 73 worked for them. You could also give that a try (chromium@edge=73.0.3683.103-r0).

In addition to downgrading Chromium, you also need to downgrade puppeteer to the corresponding version. For Chromium 72 you need to use version 1.11.0. (more information on how to detect the Chrome version to use with puppeteer)

The changed Dockerfile:

RUN apk update && apk upgrade && \
  ...
  chromium@edge=72.0.3626.121-r0 \
...

RUN ...
    npm install [email protected] && \

Upvotes: 3

Related Questions