Tomato6966 / lavalink-client

Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
https://tomato6966.github.io/lavalink-client/
MIT License
48 stars 13 forks source link

this.LavalinkManager.nodeManager.nodes.get(newNode).get not a function #8

Closed KasaiKonoru closed 12 months ago

KasaiKonoru commented 1 year ago

this.LavalinkManager.nodeManager.nodes.get(newNode).get not a function

KasaiKonoru commented 1 year ago

I always get this error: "Error: Lavalink Node does not have any info cached yet, not ready yet!"

Tomato6966 commented 1 year ago

why do you want to do node.get() there is no node.get() function.

The error is when it' can't fetch the info of lavalink server, are you sure your lavalink server is v4?

KasaiKonoru commented 1 year ago

yes Its running. I mean node.get() is in the npm package. I copied the example from the docs

KasaiKonoru commented 1 year ago
Here are some lavalink server logs: 2023-09-05T14:21:25.717+02:00 INFO 266749 --- [ main] lavalink.server.Launcher : Started Launcher in 2.059 seconds (process running for 4.196)
2023-09-05T14:21:25.719+02:00 INFO 266749 --- [ main] lavalink.server.Launcher : Lavalink is ready to accept connections.
2023-09-05T14:39:22.236+02:00 INFO 266749 --- [ XNIO-1 task-2] io.undertow.servlet : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-09-05T14:39:22.236+02:00 INFO 266749 --- [ XNIO-1 task-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-09-05T14:39:22.238+02:00 INFO 266749 --- [ XNIO-1 task-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2023-09-05T14:39:22.264+02:00 INFO 266749 --- [ XNIO-1 task-2] l.server.io.HandshakeInterceptorImpl : Incoming connection from /127.0.0.1:37304
2023-09-05T14:39:22.285+02:00 INFO 266749 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : GET /v4/websocket, client=127.0.0.1
2023-09-05T14:39:22.351+02:00 INFO 266749 --- [ XNIO-1 task-2] lavalink.server.io.SocketServer : Connection successfully established from XX
2023-09-05T14:39:23.872+02:00 INFO 266749 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : GET /v4/info?trace=true, client=127.0.0.1
2023-09-05T14:43:26.379+02:00 INFO 266749 --- [ XNIO-1 I/O-2] lavalink.server.io.SocketServer : Connection closed from /127.0.0.1:37304 with id dol21jf0ejhm6iqr -- CloseStatus[code=1006, reason=]
2023-09-05T14:43:26.379+02:00 INFO 266749 --- [ XNIO-1 I/O-2] lavalink.server.io.SocketContext : Shutting down 0 playing players.
2023-09-05T14:43:47.677+02:00 INFO 266749 --- [ XNIO-1 task-2] l.server.io.HandshakeInterceptorImpl : Incoming connection from /127.0.0.1:50276
2023-09-05T14:43:47.678+02:00 INFO 266749 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : GET /v4/websocket, client=127.0.0.1
2023-09-05T14:43:47.680+02:00 INFO 266749 --- [ XNIO-1 task-2] lavalink.server.io.SocketServer : Connection successfully established from XX
KasaiKonoru commented 1 year ago

And this.nodeManager.nodes is called: "Minimap" and set() is a function there but not get()

KasaiKonoru commented 1 year ago

And this is the right Lavalink.jar file or? https://github.com/lavalink-devs/Lavalink/releases/tag/4.0.0-beta.3

KasaiKonoru commented 1 year ago

It connects and then when I want to search for a track I get a problem with "Error: Lavalink Node does not have any info cached yet, not ready yet!"

Completed initialization in 2 ms
2023-09-05T17:13:55.908+02:00 INFO 335614 --- [ XNIO-1 task-2] l.server.io.HandshakeInterceptorImpl : Incoming connection from /127.0.0.1:51458
2023-09-05T17:13:55.926+02:00 INFO 335614 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : GET /v4/websocket, client=127.0.0.1
2023-09-05T17:13:55.999+02:00 INFO 335614 --- [ XNIO-1 task-2] lavalink.server.io.SocketServer : Connection successfully established from XX
2023-09-05T17:13:56.478+02:00 INFO 335614 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : PATCH /v4/sessions/afpg8zx4w1gglea3/players/817115863870210078?trace=true, client=127.0.0.1, payload={"voice":{"token":"53d287e3c55bffb7","endpoint":"frankfurt1638.discord.media:443","sessionId":"a79083a0cde74bf871fd888c0c22ee27"}}
2023-09-05T17:13:57.464+02:00 INFO 335614 --- [ XNIO-1 task-2] l.server.io.RequestLoggingFilter : GET /v4/info?trace=true, client=127.0.0.1
KasaiKonoru commented 1 year ago

in Utils.js

validateSourceString(node, sourceString) {
        if (!sourceString)
            throw new Error(`No SourceString was provided`);
        const source = LavalinkManagerStatics_1.DefaultSources[sourceString.toLowerCase().trim()];
        if (!source)
            throw new Error(`Lavalink Node SearchQuerySource: '${sourceString}' is not available`);
        if (!node.info)
            throw new Error("Lavalink Node does not have any info cached yet, not ready yet!");
}
Tomato6966 commented 1 year ago

First you said LavalinkNode.get() which clearly is not a function and not existing in the package what you probably ment is NodeManager.nodes.get() which works.

In MiniMap there is a .get() and a .set() etc. etc. cause it EXTENDS Map (aka all the features a MAP has, MiniMap also has)

The error ("Lavalink Node does not have any info cached yet, not ready yet!") happens, because you try to create a player before the request to retrieve the info hasn't been made yet, simply wait 1second...

I still don't know what you mean with the ORIGINAL message at the top: "this.LavalinkManager.nodeManager.nodes.get(newNode).get not a function" Is this an error, do you try to do it, or what is it?

Do you use it in typescript / cjs / mjs / esm from which example in the docs did you copy "this.LavalinkManager.nodeManager.nodes.get(newNode).get"

Tomato6966 commented 1 year ago

in the internals the nodemanager used to wait 1.5secs after connecting to fetch the info, due to some old bugs and debugs. which will be set to "instant fetching" and before omitting the 'connect' event soon

Edit: With release: v1.1.15 it fetches the info before nodeManager.on("connect") get's emitted. therefore, you can not mess things up.

KasaiKonoru commented 1 year ago

thx. Yeah that was that what I mean. Thank you so much