node-chromium icon indicating copy to clipboard operation
node-chromium copied to clipboard

Generating PDFs from chrome binary failing now, worked before

Open Keavon opened this issue 2 years ago • 0 comments

Hello, I use npm to globally install this package and then directly call /opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/chromium/lib/chromium/chrome-linux/chrome. I can still call it as chrome --version and get the response of Chromium 111.0.5518.0. But I can no longer generate PDFs from files.

I've been using this in a Cloudflare Pages CI environment to deploy my HTML-based resume as a PDF to my website:

$CHROME_PATH \
	--headless \
	--no-sandbox \
	--disable-gpu \
	--disable-web-security \
	--run-all-compositor-stages-before-draw \
	--virtual-time-budget=5000 \
	--font-render-hinting=none \
	--print-to-pdf=dist/resume.pdf \
	file://$(pwd)/resume/resume.html

Over the summer, I updated my resume most recently and it worked as normal, just like since I set this up a couple years ago. But now it's failing:

16:17:33.564 | [0104/001733.563880:ERROR:file_path_watcher_inotify.cc(823)] Failed to read /proc/sys/fs/inotify/max_user_watches
16:17:33.569 | [0104/001733.569067:ERROR:file_path_watcher_inotify.cc(823)] Failed to read /proc/sys/fs/inotify/max_user_watches
16:17:33.574 | [0104/001733.574066:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
16:17:34.111 | [0104/001734.111241:ERROR:address_tracker_linux.cc(208)] Could not bind NETLINK socket: Permission denied (13)
16:17:34.112 | [0104/001734.111966:ERROR:file_path_watcher_inotify.cc(823)] Failed to read /proc/sys/fs/inotify/max_user_watches
16:17:34.112 | [0104/001734.112277:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
16:17:34.113 | [0104/001734.113033:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
16:17:34.170 | [0104/001734.169979:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process.
16:17:34.219 | [0104/001734.219576:ERROR:file_path_watcher_inotify.cc(823)] Failed to read /proc/sys/fs/inotify/max_user_watches
16:17:34.220 | [0104/001734.219572:ERROR:address_tracker_linux.cc(208)] Could not bind NETLINK socket: Permission denied (13)
16:17:36.563 | [0104/001734.143860:FATAL:headless_command_handler.cc(61)] Check failed: base::PathExists(resource_pack). /opt/buildhome/.nvm/versions/node/v12.18.0/lib/node_modules/chromium/lib/chromium/chrome-linux/headless_command_resources.pak
16:17:36.563 | #0 0x556febf2f432 base::debug::CollectStackTrace()
16:17:36.564 | #1 0x556febe8dc03 base::debug::StackTrace::StackTrace()
16:17:36.564 | #2 0x556febe8a888 logging::LogMessage::~LogMessage()
16:17:36.564 | #3 0x556febe8b43e logging::LogMessage::~LogMessage()
16:17:36.564 | #4 0x556feb9e39e8 headless::HeadlessCommandHandler::HeadlessCommandHandler()
16:17:36.564 | #5 0x556feb9e3bc5 headless::HeadlessCommandHandler::ProcessCommands()
16:17:36.564 | #6 0x556feb9e1fb0 headless::HeadlessShell::OnBrowserStart()
16:17:36.564 | #7 0x556ff1e81947 headless::HeadlessBrowserImpl::RunOnStartCallback()
16:17:36.564 | #8 0x556ff1e82c38 headless::HeadlessBrowserMainParts::PreMainMessageLoopRun()
16:17:36.565 | #9 0x556fea00fb2a content::BrowserMainLoop::PreMainMessageLoopRun()
16:17:36.565 | #10 0x556fea60e5d5 content::StartupTaskRunner::RunAllTasksNow()
16:17:36.565 | #11 0x556fea00f709 content::BrowserMainLoop::CreateStartupTasks()
16:17:36.565 | #12 0x556fea0122dc content::BrowserMainRunnerImpl::Initialize()
16:17:36.565 | #13 0x556ff1e890ca headless::HeadlessContentMainDelegate::RunProcess()
16:17:36.565 | #14 0x556feb996242 content::RunBrowserProcessMain()
16:17:36.565 | #15 0x556feb997706 content::ContentMainRunnerImpl::RunBrowser()
16:17:36.565 | #16 0x556feb99749a content::ContentMainRunnerImpl::Run()
16:17:36.565 | #17 0x556feb994065 content::RunContentProcess()
16:17:36.566 | #18 0x556feb9948ff content::ContentMain()
16:17:36.566 | #19 0x556feb9e285f headless::(anonymous namespace)::RunContentMain()
16:17:36.566 | #20 0x556feb9e24b5 headless::HeadlessShellMain()
16:17:36.566 | #21 0x556fe7c051dc ChromeMain
16:17:36.566 | #22 0x7f50ace20840 __libc_start_main
16:17:36.566 | #23 0x556fe7c0502a _start
16:17:36.566 |  
16:17:36.571 | Trace/breakpoint trap

Debugging this sort of thing is out of my area of expertise. I'd really appreciate some help restoring this functionality in my setup!

Keavon avatar Jan 04 '23 00:01 Keavon