Lavalink server is not connecting properly

Code:
var {
MoonlinkManager
} = require("moonlink.js"),
config = require(`${process.cwd()}/botconfig/config.json`),
clientID = process.env.clientID || config.spotify.clientID,
clientSecret = process.env.clientSecret || config.spotify.clientSecret;
module.exports = (client) => {
client.manager = new MoonlinkManager([{ //1. Nodes
host: 'node1.lewdhutao.tech',
port: 1183,
secure: false,
password: "lewdhutao"
}], { //2. Options
shards: 1,
spotify: { clientId: config.spotify.clientID, clientSecret: config.spotify.clientSecret }
}, (guild, sPayload) => { //3. Function
client.guilds.cache.get(guild).shard.send(JSON.parse(sPayload))
})
//require the other events
require("./node_events")(client)
require("./client_events")(client)
require("./events")(client)
require("./musicsystem")(client)

};
var {
MoonlinkManager
} = require("moonlink.js"),
config = require(`${process.cwd()}/botconfig/config.json`),
clientID = process.env.clientID || config.spotify.clientID,
clientSecret = process.env.clientSecret || config.spotify.clientSecret;
module.exports = (client) => {
client.manager = new MoonlinkManager([{ //1. Nodes
host: 'node1.lewdhutao.tech',
port: 1183,
secure: false,
password: "lewdhutao"
}], { //2. Options
shards: 1,
spotify: { clientId: config.spotify.clientID, clientSecret: config.spotify.clientSecret }
}, (guild, sPayload) => { //3. Function
client.guilds.cache.get(guild).shard.send(JSON.parse(sPayload))
})
//require the other events
require("./node_events")(client)
require("./client_events")(client)
require("./events")(client)
require("./musicsystem")(client)

};
Then it keeps saying connected and reconnecting. When attempting to play it throws an error:
TypeError: Cannot read properties of undefined (reading 'rest')
at MoonlinkManager.create (/home/ubuntu/node_modules/moonlink.js/dist/src/@Moonlink/MoonlinkManager.js:272:120)
at song (/home/ubuntu/handlers/playermanagers/song.js:25:43)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'rest')
at MoonlinkManager.create (/home/ubuntu/node_modules/moonlink.js/dist/src/@Moonlink/MoonlinkManager.js:272:120)
at song (/home/ubuntu/handlers/playermanagers/song.js:25:43)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
With other lavalinks the connection just times out:
=== UNCAUGHT EXCEPTION ===
Exception: Error: connect ETIMEDOUT IP:PORT
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
=== UNCAUGHT EXCEPTION ===
=== UNCAUGHT EXCEPTION ===
Exception: Error: connect ETIMEDOUT IP:PORT
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
=== UNCAUGHT EXCEPTION ===
Using the latest version of Moonlink.js from NPM
17 Replies
continuing-cyan
continuing-cyanOP•2y ago
hosting on aws ubuntu ec2 instance
1Lucas1.apk
1Lucas1.apk•2y ago
Error in the rest is that it was not connected to the lavalink Is lavalink's endpoint http or https?
continuing-cyan
continuing-cyanOP•2y ago
HTTPS
MEE6
MEE6•2y ago
GG @paninizer, you just advanced to level 3!
continuing-cyan
continuing-cyanOP•2y ago
Or it should be
1Lucas1.apk
1Lucas1.apk•2y ago
Then change the secure parameter to true
continuing-cyan
continuing-cyanOP•2y ago
It worked like 5 days ago Then the error started showing up
1Lucas1.apk
1Lucas1.apk•2y ago
Secure is type for it to distinguish if ws and http is secure it will add s "wss" and "https"
[{ //1. Nodes
host: 'node1.lewdhutao.tech',
port: 1183,
secure: true,
password: "lewdhutao"
}]
[{ //1. Nodes
host: 'node1.lewdhutao.tech',
port: 1183,
secure: true,
password: "lewdhutao"
}]
continuing-cyan
continuing-cyanOP•2y ago
I'll try secured But the hosting list did not have the secure on true And none of any other lavalink I tried work, secure or not It either times out or constantly switches between connected and reconnecting (but the nodes are null)
adverse-sapphire
adverse-sapphire•2y ago
Same problem is with your own hosted lavalink servers im getting same issue using "erela.js" Found the issue For erela in Node.js file u need to add ready case inorder for it to work i guess same goes with moonlink since they are kinda close
continuing-cyan
continuing-cyanOP•2y ago
its just backend lavalink server compatibility with client ig
adverse-sapphire
adverse-sapphire•2y ago
Not exactly Well yes its 50/50 Both are the issues With lavalink the issue is that, outdated version doesnt use all new changes within youtube API if i remember right As in for "moonlink"(maybe) and erela, which im using, is that I had to change erela.js(Node.js) file by adding op "ready", which will get rid of "Node "caffeine.srv.berrybyte" encountered an error: Unexpected op "ready" with data: [object Object]"
MEE6
MEE6•2y ago
GG @Cloudz ジ, you just advanced to level 1!
adverse-sapphire
adverse-sapphire•2y ago
Then I removed client.on("raw", d => client.manager.updateVoiceState(d)) and now it works fine and no the lewd hutao domain is not https its http secure: false i tis it is forgot to mention that
continuing-cyan
continuing-cyanOP•2y ago
So I switched around some lavalinks and it worked. Prob just compatibility issues since I didn't change anything else
adverse-sapphire
adverse-sapphire•2y ago
Nice, good luck on deving.
continuing-cyan
continuing-cyanOP•2y ago

Did you find this page helpful?