EI
foreign-sapphire

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
foreign-sapphire
foreign-sapphireOP3y ago
hosting on aws ubuntu ec2 instance
1Lucas1.apk
1Lucas1.apk3y ago
Error in the rest is that it was not connected to the lavalink Is lavalink's endpoint http or https?
foreign-sapphire
foreign-sapphireOP3y ago
HTTPS
MEE6
MEE63y ago
GG @paninizer, you just advanced to level 3!
foreign-sapphire
foreign-sapphireOP3y ago
Or it should be
1Lucas1.apk
1Lucas1.apk3y ago
Then change the secure parameter to true
foreign-sapphire
foreign-sapphireOP3y ago
It worked like 5 days ago Then the error started showing up
1Lucas1.apk
1Lucas1.apk3y 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"
}]
foreign-sapphire
foreign-sapphireOP3y 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)
genetic-orange
genetic-orange3y 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
foreign-sapphire
foreign-sapphireOP3y ago
its just backend lavalink server compatibility with client ig
genetic-orange
genetic-orange3y 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
MEE63y ago
GG @Cloudz ジ, you just advanced to level 1!
genetic-orange
genetic-orange3y 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
foreign-sapphire
foreign-sapphireOP3y ago
So I switched around some lavalinks and it worked. Prob just compatibility issues since I didn't change anything else
genetic-orange
genetic-orange3y ago
Nice, good luck on deving.
foreign-sapphire
foreign-sapphireOP3y ago

Did you find this page helpful?