appujet / lavamusic

lavalink music bot base in lavalink-client and discord.js v14
https://appujet.github.io/lavamusic/
GNU General Public License v3.0
567 stars 494 forks source link

[Bug]: Can't connect to lavalink #735

Closed SsSAtonioSsS closed 1 week ago

SsSAtonioSsS commented 1 week ago

Bug description

After the bot is launched, an attempt is made to connect to the node. After that an error occurs. I tried to specify node both localhost or 127.0.0.1. Lavalink runned and listened at 127.0.0.1:2333.

Steps to reproduce

Configure lavalink and bot, run all.

Operating System

Ubuntu 22.04.5 LTS

Node.js version

20.17.0

java version

17.0.12

Application/Library version

5.0.0-beta

Error logs or screenshots


    █░░ ▄▀█ █░█ ▄▀█ █▀▄▀█ █░█ █▀ █ █▀▀
    █▄▄ █▀█ ▀▄▀ █▀█ █░▀░█ █▄█ ▄█ █ █▄▄

             .:::.=++=:.:-:
            =##############*
            *###############.
             =++=*####*=++=:
                 .*##*:
               .+######*:
              =*#########+.
            :*############*-
           =################*.
         :*##################*=
       .+######################*:
       *#########################.
       .::::::::::::::::::::::::.

[9/28/2024] [11:33:35 AM] [I18n.js] [Lavamusic] › ℹ  info      I18n has been initialized
[9/28/2024] [11:33:35 AM] [Lavamusic.js] [Lavamusic] › ⚠  warn      Top.gg token not found!
[9/28/2024] [11:33:35 AM] [Lavamusic.js] [Lavamusic] › ℹ  info      Successfully loaded commands!
[9/28/2024] [11:33:35 AM] [Lavamusic.js] [Lavamusic] › ℹ  info      Successfully loaded events!
[9/28/2024] [11:33:35 AM] [index.js] [Lavamusic] › ℹ  info      Loaded plugin: AntiCrash Plugin v1.0.0
[9/28/2024] [11:33:35 AM] [index.js] [Lavamusic] › ℹ  info      Loaded plugin: KeepAlive Plugin v1.0.0
[9/28/2024] [11:33:35 AM] [index.js] [Lavamusic] › ℹ  info      Loaded plugin: Update Status Plugin v1.0.0
[9/28/2024] [11:33:36 AM] [Ready.js] [Lavamusic] › ✔  success   Ru-Zoна#8467 is ready!
[9/28/2024] [11:33:36 AM] [Ready.js] [Lavamusic] › ⚠  warn      Top.gg token not found. Skipping auto poster.
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Client-Name"]
    at ClientRequest.setHeader (node:_http_outgoing:662:3)
    at new ClientRequest (node:_http_client:300:14)
    at request (node:http:103:10)
    at initAsClient (/home/bot-core/node_modules/ws/lib/websocket.js:868:28)
    at new WebSocket (/home/bot-core/node_modules/ws/lib/websocket.js:88:7)
    at LavalinkNode.connect (/home/bot-core/node_modules/lavalink-client/dist/index.js:1261:19)
    at LavalinkClient.init (/home/bot-core/node_modules/lavalink-client/dist/index.js:4358:20)
    at Ready.run (/home/bot-core/dist/events/client/Ready.js:34:35)
    at Lavamusic.<anonymous> (/home/bot-core/dist/structures/Lavamusic.js:178:60)
    at Lavamusic.emit (node:events:531:35) {
  code: 'ERR_INVALID_CHAR'
}
[9/28/2024] [11:33:36 AM] [antiCrash.js] [Lavamusic] › ✖  error     Uncaught Exception thrown: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (<ref *2> LavalinkNode {
  heartBeatPingTimestamp: 0,
  heartBeatPongTimestamp: 0,
  heartBeatInterval: undefined,
  pingTimeout: undefined,
  options: {
    secure: false,
    retryAmount: 5,
    retryDelay: 10000,
    requestSignalTimeoutMS: 10000,
    heartBeatInterval: 30000,
    closeOnError: true,
    enablePingOnStatsCheck: true,
    id: 'LocalNode',
    host: 'localhost',
    port: 2333,
    authorization: '123',
    regions: []
  },
  calls: 0,
  stats: {
    players: 0,
    playingPlayers: 0,
    cpu: { cores: 0, lavalinkLoad: 0, systemLoad: 0 },
    memory: { allocated: 0, free: 0, reservable: 0, used: 0 },
    uptime: 0,
    frameStats: { deficit: 0, nulled: 0, sent: 0 }
  },
  sessionId: null,
  resuming: { enabled: true, timeout: null },
  info: null,
  NodeManager: <ref *1> NodeManager {
    _events: [Object: null prototype] {
      connect: [Function (anonymous)],
      destroy: [Function (anonymous)]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    LavalinkManager: LavalinkClient {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      options: [Object],
      nodeManager: [Circular *1],
      utils: [ManagerUtils],
      initiated: false,
      players: MiniMap(0) [Map] {},
      client: [Lavamusic],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false
    },
    nodes: MiniMap(1) [Map] { 'LocalNode' => [Circular *2] },
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false
  },
  reconnectTimeout: undefined,
  reconnectAttempts: 1,
  socket: null,
  version: 'v4',
  isAlive: false,
  decode: {
    singleTrack: [AsyncFunction: singleTrack],
    multipleTracks: [AsyncFunction: multipleTracks]
  },
  lyrics: {
    get: [AsyncFunction: get],
    getCurrent: [AsyncFunction: getCurrent],
    subscribe: [AsyncFunction: subscribe],
    unsubscribe: [AsyncFunction: unsubscribe]
  },
  routePlannerApi: {
    getStatus: [AsyncFunction: getStatus],
    unmarkFailedAddress: [AsyncFunction: unmarkFailedAddress],
    unmarkAllFailedAddresses: [AsyncFunction: unmarkAllFailedAddresses]
  }
})
    at NodeManager.emit (node:events:508:17)
    at NodeManager.emit (/home/bot-core/node_modules/lavalink-client/dist/index.js:2235:18)
    at LavalinkClient.init (/home/bot-core/node_modules/lavalink-client/dist/index.js:4362:26)
    at Ready.run (/home/bot-core/dist/events/client/Ready.js:34:35)
    at Lavamusic.<anonymous> (/home/bot-core/dist/structures/Lavamusic.js:178:60)
    at Lavamusic.emit (node:events:531:35)
    at WebSocketManager.triggerClientReady (/home/bot-core/node_modules/discord.js/src/client/websocket/WebSocketManager.js:381:17)
    at WebSocketManager.checkShardsReady (/home/bot-core/node_modules/discord.js/src/client/websocket/WebSocketManager.js:364:10)
    at WebSocketShard.<anonymous> (/home/bot-core/node_modules/discord.js/src/client/websocket/WebSocketManager.js:194:16)
    at WebSocketShard.emit (node:events:519:28) {
  code: 'ERR_UNHANDLED_ERROR',
  context: LavalinkNode {
    heartBeatPingTimestamp: 0,
    heartBeatPongTimestamp: 0,
    heartBeatInterval: undefined,
    pingTimeout: undefined,
    options: {
      secure: false,
      retryAmount: 5,
      retryDelay: 10000,
      requestSignalTimeoutMS: 10000,
      heartBeatInterval: 30000,
      closeOnError: true,
      enablePingOnStatsCheck: true,
      id: 'LocalNode',
      host: 'localhost',
      port: 2333,
      authorization: '123',
      regions: []
    },
    calls: 0,
    stats: {
      players: 0,
      playingPlayers: 0,
      cpu: [Object],
      memory: [Object],
      uptime: 0,
      frameStats: [Object]
    },
    sessionId: null,
    resuming: { enabled: true, timeout: null },
    info: null,
    NodeManager: NodeManager {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      LavalinkManager: [LavalinkClient],
      nodes: [MiniMap [Map]],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false
    },
    reconnectTimeout: undefined,
    reconnectAttempts: 1,
    socket: null,
    version: 'v4',
    isAlive: false,
    decode: {
      singleTrack: [AsyncFunction: singleTrack],
      multipleTracks: [AsyncFunction: multipleTracks]
    },
    lyrics: {
      get: [AsyncFunction: get],
      getCurrent: [AsyncFunction: getCurrent],
      subscribe: [AsyncFunction: subscribe],
      unsubscribe: [AsyncFunction: unsubscribe]
    },
    routePlannerApi: {
      getStatus: [AsyncFunction: getStatus],
      unmarkFailedAddress: [AsyncFunction: unmarkFailedAddress],
      unmarkAllFailedAddresses: [AsyncFunction: unmarkAllFailedAddresses]
    }
  }
}
[9/28/2024] [11:33:36 AM] [shard.js] [Lavamusic] › ▶  start     [CLIENT] Shard 0 connected to Discord's Gateway.
[9/28/2024] [11:33:36 AM] [shard.js] [Lavamusic] › ▶  start     [CLIENT] 1 shard(s) spawned.
[9/28/2024] [11:33:39 AM] [antiCrash.js] [Lavamusic] › ✖  error     Uncaught Exception thrown: Error: No available Node was found, please add a LavalinkNode to the Manager via Manager.NodeManager#createNode
    at new Player (/home/bot-core/node_modules/lavalink-client/dist/index.js:3489:27)
    at LavalinkClient.createPlayer (/home/bot-core/node_modules/lavalink-client/dist/index.js:4275:23)
    at Play.run (/home/bot-core/dist/commands/music/Play.js:52:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Additional context

SsSAtonioSsS commented 1 week ago

Temporarily added cyrillic-to-translit-js to Ready.ts for username. It's works.

appujet commented 1 week ago

Invalid character in header content ["Client-Name"]

you put Invalid character in header content ["Client-Name"] in to ready.js