Multivit4min / TS3-NodeJS-Library

TeamSpeak 3 Server Query Library supports SSH and RAW Query
https://multivit4min.github.io/TS3-NodeJS-Library/
MIT License
150 stars 19 forks source link

invalid serverID Docker #58

Closed BenediktBertsch closed 5 years ago

BenediktBertsch commented 5 years ago

Describe the bug Docker Container cant start: Output

CATCHED invalid serverID
{ Error: invalid serverID

at Command.getError (/nodeapp/node_modules/ts3-nodejs-library/src/transport/Command.js:143:12)
at TS3Query.handleQueryError (/nodeapp/node_modules/ts3-nodejs-library/src/transport/TS3Query.js:142:44)
at TS3Query.handleLine (/nodeapp/node_modules/ts3-nodejs-library/src/transport/TS3Query.js:116:12)
at RAW.emit (events.js:198:13)
at lines.forEach.line (/nodeapp/node_modules/ts3-nodejs-library/src/transport/protocols/raw.js:81:32)
at Array.forEach (<anonymous>)
at RAW._handleData (/nodeapp/node_modules/ts3-nodejs-library/src/transport/protocols/raw.js:81:11)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:265:13)
id: 1024,
msg: 'invalid serverID',
extra_msg: undefined,
failed_permid: undefined }

Versions used

Additional context Local does the program work with hardcoded settings. With Docker environment settings it doesnt work.

Thank you for the amazing library.

Multivit4min commented 5 years ago

Can you send me code to reproduce? Invalid serverID occurs when you send for example the clientlist command without selecting a server

BenediktBertsch commented 5 years ago

Hey @Multivit4min,

the whole Code is in my Repository (https://github.com/BenediktBertsch/Micro_TeamSpeak_Bot)

Thank you.

Multivit4min commented 5 years ago

The CI tests also connects to a docker environment and this works without any problems https://github.com/Multivit4min/TS3-NodeJS-Library/blob/master/test/integration.js#L62

And to be honest i have never run a NodeJS app inside a docker container yet but you could listen to the debug event and just log everything to see what gets sent to the teamspeak server and what the query receives back from the ts3 server

ts3.on("debug", console.log)
Multivit4min commented 5 years ago

as far as I can tell the error gets logged here https://github.com/BenediktBertsch/Micro_TeamSpeak_Bot/blob/master/index.js#L96

so i can only assume that no teamspeak server has been selected

EDIT: I guess i found it https://github.com/Multivit4min/TS3-NodeJS-Library/blob/master/src/TeamSpeak3.js#L225 I check for a serverport with typeof number but all environment variables are being interpreted as string

so when connecting to the TeamSpeak Server please use

const ts3 = new teamspeak({
    host: process.env.TShost,
    queryport: parseInt(process.env.TSqueryport, 10),
    serverport: parseInt(process.env.TSserverport, 10),
    username: process.env.TSqueryusername,
    password: process.env.TSquerypassword,
    nickname: process.env.TSnickname,
    keepalive: config.bot.settings.keepalive
})
BenediktBertsch commented 5 years ago

Hey,

I tested it in debugging and tried to figure it out and then tried your idea, and it works now. Thank you!