GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.24k stars 812 forks source link

[Bug]: Bug in gamedig library, causing health check to fail #4624

Open FingerlessGlov3s opened 1 month ago

FingerlessGlov3s commented 1 month ago

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

FingerlessGlov3s commented 1 month ago

Hopefully this will get fixed upstream soon https://github.com/gamedig/node-gamedig/pull/602

irobot73 commented 1 month ago

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.

CosminPerRam commented 1 month ago

Hey, I'm the GameDig maintainer, 5.1.1 and 4.3.2 are released with the fixes.

dgibbs64 commented 1 month ago

I will update the version of LInuxGSM and release a hotfix