[Bug]: Bug in gamedig library, causing health check to fail
User story
Creating new docker container with latest image
Game
7 Dyas to Die
Linux distro
Debian 12
Command
command: monitor
Further information
When the monitor is running, it errors checking the ports because of a module within the farmingsimulator gamedig package code. As it errors, it keeps restarting the sdtd server.
Relevant log output
root@d52ea70abad0:/app# ./entrypoint-healthcheck.sh
[ OK ] Monitoring sdtdserver: Checking session: OK
[ .... ] Monitoring sdtdserver: Querying port: gamedig: 127.0.0.1:26900 : 0/1: QUERYINGfile:///app/lgsm/node_modules/gamedig/protocols/farmingsimulator.js:2
import cheerio from 'cheerio'
^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.16.0
[ .... ] Monitoring sdtdserver: Querying port: gamedig: 172.16.0.129:26900 : 0/1: QUERYINGfile:///app/lgsm/node_modules/gamedig/protocols/farmingsimulator.js:2
import cheerio from 'cheerio'
^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.16.0
[ .... ] Monitoring sdtdserver: Querying port: gamedig: 78.157.222.153:26900 : 0/1: QUERYINGfile:///app/lgsm/node_modules/gamedig/protocols/farmingsimulator.js:2
import cheerio from 'cheerio'
^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Steps to reproduce
Setup sdtd container using the sdtd docker compose example file. Server won't stay started and reboots.
To fix, you can manually change the import line
import cheerio from 'cheerio'
to
import * as cheerio from 'cheerio'
As per readme on the cheerio package. https://www.npmjs.com/package/cheerio
Hopefully this will get fixed upstream soon https://github.com/gamedig/node-gamedig/pull/602
Good catch. Modifying that './lgsm/node_modules/gamedig/protocols/farmingsimulator.js', while the server was down, finally allowed the server to stay up when started. I'll allow the LGSM UPDATE via CRONTAB to execute again once this gets some coding love.
Hey, I'm the GameDig maintainer, 5.1.1 and 4.3.2 are released with the fixes.
I will update the version of LInuxGSM and release a hotfix
this should have been fixed with 24.2.2 please reopen if that is not the case.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.