puppeteer: Question: Broken example?

OS: GNU / Debian testing 64-bit
Node.js: v7.10.1

I have tried the PDF example and when I run it, Node rejected it for the following reasons:

(node:8043) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome! (node:8043) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any suggestions please?

Cheers.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@Garbee thanks for pointing out issue #290.

@aslushnikov’s suggestion fixed my problem. Indeed it is sandbox’s problem and you have to be explicit when launching.

By adding {args: ['--no-sandbox']} inside await puppeteer.launch() works as expected.

👍 to @aslushnikov for figuring out.

Cheers to both of you folks.

Looks related to #290. So check that thread for discussion on that.

You can go ahead and run these two scripts to verify your OS has everything required for Chromium to run.

Debian check
#!/bin/bash

packages="gconf-service
libasound2
libatk1.0-0
libc6
libcairo2
libcups2
libdbus-1-3
libexpat1
libfontconfig1
libgcc1
libgconf-2-4
libgdk-pixbuf2.0-0
libglib2.0-0
libgtk-3-0
libnspr4
libpango-1.0-0
libpangocairo-1.0-0
libstdc++6
libx11-6
libx11-xcb1
libxcb1
libxcomposite1
libxcursor1
libxdamage1
libxext6
libxfixes3
libxi6
libxrandr2
libxrender1
libxss1
libxtst6
ca-certificates
fonts-liberation
libappindicator1
libnss3
lsb-release
xdg-utils
wget"

declare -a neededPackages

for packageName in $packages; do
  if ! dpkg-query -l "$packageName" > /dev/null 2>&1; then
    neededPackages[${#neededPackages[@]}]="$packageName"
  fi
done


neededCount=${#neededPackages[@]}

if [[ $neededCount -gt 0 ]]; then
  echo "-----------------------------------------------------"
  echo "Run the following to get all of the required packages"
  echo "-----------------------------------------------------"
  echo "sudo apt install \\"
  for i in "${neededPackages[@]}"; do
    output="$i"

     if [[ ${neededPackages[@]: -1 } != "$i" ]]; then
        output+=" \\"
     fi

    echo "$output"
  done
  echo "-----------------------------------------------------"
fi

exit 0
Namespace check
#!/bin/bash

VALUE=$(cat /boot/config-$(uname -r) | grep CONFIG_USER_NS)

if [[ -z "$VALUE" ]]
then
  echo 'You do not have namespacing in the kernel. You will need to enable the SUID sandbox or upgrade your kernel.'
  echo 'See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md'
  exit 1
fi

USER_NS_AVAILABLE="${VALUE: -1}"

if [[ "$USER_NS_AVAILABLE" == "y" ]]
then
  exit 0
else
  echo 'You do not have namespacing in the kernel. You will need to enable the SUID sandbox or upgrade your kernel.'
  echo 'See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md'
  exit 1
fi

If you get no output, then all the things required to run Chromium should be there. If you get an error, follow what the instructions provided in the output.