Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"_projectRoot is undefined. Unable to create a BrowserFetcher" while running an app in docker #1404

Closed
1 task done
StefanoVe opened this issue Apr 20, 2022 · 4 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@StefanoVe
Copy link

StefanoVe commented Apr 20, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

the whatsapp client in my app doesn't initialize correctly while running in docker (throwing the following error) but runs perfectly fine on my Macbook

2022-04-20T10:27:22.917053336Z Error: _projectRoot is undefined. Unable to create a BrowserFetcher.
2022-04-20T10:27:22.917057531Z at resolveExecutablePath (/usr/src/app/main.js:202314:15)
2022-04-20T10:27:22.917061555Z at ChromeLauncher.launch (/usr/src/app/main.js:201797:53)
2022-04-20T10:27:22.917068383Z at async Client.initialize (/usr/src/app/main.js:539830:23)

Dockerfile

FROM node:13.11.0

RUN mkdir -p /puppeteer
WORKDIR /puppeteer

COPY ./ /puppeteer
RUN  apt-get update \
     && apt-get install -y wget gnupg ca-certificates \
     && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
     && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
     && apt-get update \
     && apt-get install -y gconf-service libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgdk-pixbuf2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libxss1 fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \
     # We install Chrome to get all the OS level dependencies, but Chrome itself
     # is not actually used as it's packaged in the node puppeteer library.
     # Alternatively, we could could include the entire dep list ourselves
     # (https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix)
     # but that seems too easy to get out of date.
     && apt-get install -y google-chrome-stable \
     && rm -rf /var/lib/apt/lists/* \
     && wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
     && chmod +x /usr/sbin/wait-for-it.sh

CMD ["node", "main.js"] 

Expected behavior

the app should run fine without throwing any sorts of error

Steps to Reproduce the Bug or Issue

  1. initialize a whatsapp-web.js client
  2. deploy the app on docker
  3. run the app

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Docker
whatsapp-web.js version: 1.16.5
Whatsapp Web Version: 2.2212.8
Node.js Version: 13.3

Additional context

No response

@StefanoVe StefanoVe added the bug Something isn't working label Apr 20, 2022
@KeruMx
Copy link
Contributor

KeruMx commented Apr 20, 2022

what ar your pupperteer args?

@StefanoVe
Copy link
Author

i haven't set any args

@ghost
Copy link

ghost commented May 15, 2022

Hi @StefanoVe, can recommend you usage of chrome-aws-lambda package, it works in the same way as a puppeteer, but with binary, it solved my issue in lambda function, I guess it should be also case for docker

@christian-bromann
Copy link

This might be related to puppeteer/puppeteer#8919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants