2

I have required to use the latest headless chrome with puppeteer on AWS Lambda and for that, I have referred: https://github.com/adieuadieu/serverless-chrome/blob/master/docs/chrome.md.

I already tried all the following approch to create headless chrome using given instruction but won't work and will get the same error as below.

  1. Locally (build headless Chromium locally is with Docker)
  2. With AWS EC2 (build Chromium using an EC2 Spot Instance (spot-block))
  3. AmazonLinux on EC2 (build Chromium without Docker using just the build.sh script)

ERROR:

ninja: Entering directory `out/Headless'
[1/26797] STAMP obj/build/win/default_exe_manifest.stamp
[2/26797] ACTION //build/util:webkit_version(//build/toolchain/linux:clang_x64)
[3/26797] STAMP obj/base/numerics/base_numerics.stamp
[4/26797] ACTION //base:build_date(//build/toolchain/linux:clang_x64)
[5/26797] STAMP obj/build/buildflag_header_h.stamp
[6/26797] STAMP obj/base/util/type_safety/type_safety.stamp
[7/26797] CXX obj/base/base_static/base_switches.o
FAILED: obj/base/base_static/base_switches.o 
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/base/base_static/base_switches.o.d -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DCR_CLANG_REVISION=\"373424-64a362e7-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -DCR_LIBCXX_REVISION=361348 -DCR_SYSROOT_HASH=bcc994cc6e5d4d6f0eec8b44e7f0a65f5a1a7b90 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -fcomplete-member-pointers -m64 -march=x86-64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -no-canonical-prefixes -Wall -Werror -Wextra -Wimplicit-fallthrough -Wthread-safety -Wextra-semi -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-reorder-init-list -Wno-final-dtor-non-final-class -Wno-sizeof-array-div -fno-omit-frame-pointer -g0 -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -O2 -fno-ident -fdata-sections -ffunction-sections -std=c++14 -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_sid_amd64-sysroot -fvisibility-inlines-hidden -c ../../base/base_switches.cc -o obj/base/base_static/base_switches.o

../../third_party/llvm-build/Release+Asserts/bin/clang++: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /build/chromium/src/third_party/llvm-build/Release+Asserts/bin/../lib/libstdc++.so.6)
ninja: build stopped: subcommand failed.
The command '/bin/sh -c sh /build.sh' returned a non-zero code: 1
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67

2 Answers2

0

The way of implementation/orchestration was changed in a lambda to use headless chrome with puppeteer compared to earlier.

I have used chrome-aws-lambda to run headless chrome with puppeteer in lambda for Nodejs10.x/12.x. Amazon has already announced EOL (End Of Life) for Nodejs8.x in lambda.

Amazon is using Amazon Linux AMI 2 for Node.js10.x/12.x and Amazon Linux AMI for Node.js8.x. Amazon Linux AMI 2 does not have some of the dependencies which will create problems to run headless chrome with puppeteer in Nodejs10.x/12.x inside lambda and therefore will use the lambda layer to run headless chrome with puppeteer on Node.js10.x/12.x.

chrome-aws-lambda will provide us the latest version of puppeteer and headless chrome.

Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
-1

I have had this problems as well, if is not required for your app to be hosted on AWS. The easiest way, to put your app in the cloud is by using Google Cloud Functions with a decent amount of RAM. Here is a video showing you how: https://www.youtube.com/watch?v=i8THvr03FaY

Josh Martin
  • 311
  • 3
  • 18