LinuxGSM icon indicating copy to clipboard operation
LinuxGSM copied to clipboard

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

Open FingerlessGlov3s opened this issue 1 year ago • 4 comments

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 avatar Aug 10 '24 20:08 FingerlessGlov3s

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

FingerlessGlov3s avatar Aug 10 '24 20:08 FingerlessGlov3s

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.

irobot73 avatar Aug 11 '24 03:08 irobot73

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

CosminPerRam avatar Aug 11 '24 12:08 CosminPerRam

I will update the version of LInuxGSM and release a hotfix

dgibbs64 avatar Aug 11 '24 17:08 dgibbs64

this should have been fixed with 24.2.2 please reopen if that is not the case.

h3o66 avatar Sep 29 '24 14:09 h3o66

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.

github-actions[bot] avatar Oct 06 '25 00:10 github-actions[bot]