[BUG] - error using statistics command
mr190e opened this issue · 14 comments
When using the statistics command (with a steam64) the following happens:
In discord the bot is stuck "Name-of-Bot is thinkig..."
And in log files I find this error:
[19:37:27] [SYSERR] : An error has occurred while executing the /statistics command
Error: Failed to launch the browser process! spawn /root/.cache/puppeteer/chrome/linux-113.0.5672.63/chrome-linux64/chrome ENOENT
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (/app/node_modules/@puppeteer/browsers/lib/cjs/launch.js:262:24)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[19:37:27] [DEBUG] : statistics executed in 729.84 ms
The error appears no matter what steamID i put in or BohemiaID
This happens because we're trying to launch a headless chromium browser, the dependencies might not be installed.
What OS are you on, some Linux distro I'm guessing - but which one specifically?
I have added STATISTICS_INCLUDE_ZONES_HEATMAP
as a server config setting - you can disable this (false) to temporarily avoid trying to initialze the headless chromium instance
Please install the Chromium dependency using sudo apt-get install chromium-browser
Not technically a bug, I have to document this and add user customization for the Chromium executable path
I have updated the documentation accordingly, please refer to: https://github.com/Mirasaki/cftools-discord-bot#prerequisites
Feel free to re-open this issue if you're still encountering issues after installing the dependency
I use the bot running from a Docker container on Ubuntu 22.04 LTS
How I get Chromium in the container installed?
Pretty quick and simple with Docker Compose, let me send you an example
@mr190e I've updated the production and development Dockerfiles to include direct support for Chromium/Puppeteer:
https://github.com/Mirasaki/cftools-discord-bot/pull/43/files
Let me know how it goes, I'll re-open this issue for now. Please download the latest bundle from the main
branch, or update your Dockerfiles manually by comparing (not recommended)
Sure thing, let me know - good luck in your travels!
Build the new image and now the statistics work, but still get this error:
[20:59:33] [SYSERR] : An error has occurred while executing the /statistics command
Error: Failed to launch the browser process! spawn /root/.cache/puppeteer/chrome/linux-113.0.5672.63/chrome-linux64/chrome ENOENT
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (/app/node_modules/@puppeteer/browsers/lib/cjs/launch.js:262:24)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[20:59:33] [DEBUG] : statistics executed in 766.36 ms
[21:03:12] [DEBUG] : <spawn-item> | Auto Complete | Queried "" in 1257.93 ms
[21:03:13] [DEBUG] : <spawn-item> | Auto Complete | Queried "c" in 0.53 ms
[21:03:14] [DEBUG] : <spawn-item> | Auto Complete | Queried "chew" in 0.34 ms
npm ERR! path /app
npm ERR! command failed
npm ERR! signal SIGTERM
npm ERR! command sh -c node .
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-06-07T20_59_11_267Z-debug-0.log
We're probably going to have to add an option to overwrite the path pointing to the Chromium executable if this doesn't work