client.voice.onVoiceStateUpdate is not a function - DiscordJS - node.js

I've been experiencing this issue for a while now; my bot was working perfectly fine about a week ago.
I'm running the latest NodeJS (15.5.1) and Discord.JS (12.5.1) and Erela.js (2.3.1)
I've tried reinstalling all of them with still the return issue (below),
I've asked more than 10 times in the Official Discord.JS server with no avail,
I've asked in the Erela.js Official Discord (awaiting reply)
I'm completely out of ideas as to why I am getting this issue, theres literally nothing with my code as it worked fine, and was running on the latest modules (described above erela.js & discord.js)
Now all of a sudden approx. a week ago now, this issue appeared and I've been trying to troubleshoot it ever since discovering the issue.
I have provided the full stacktrace below along with link to the exact file from discord.js src:
Discord.JS Repo - VoiceStateUpdate.js
[2:57:49 PM] ERROR [Uncaught Exception]: TypeError: client.voice.onVoiceStateUpdate is not a function
at VoiceStateUpdate.handle
(/home/thewarden/node_modules/discord.js/src/client/actions/VoiceStateUpdate.js:31:22)
at Object.module.exports [as VOICE_STATE_UPDATE]
(/home/thewarden/node_modules/discord.js/src/client/websocket/handlers/VOICE_STATE_UPDATE.js:4:35)
at WebSocketManager.handlePacket
(/home/thewarden/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket
(/home/thewarden/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage
(/home/thewarden/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/thewarden/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (node:events:376:20)
at Receiver.receiverOnMessage (/home/thewarden/node_modules/ws/lib/websocket.js:825:20)
at Receiver.emit (node:events:376:20)
at Receiver.dataMessage (/home/thewarden/node_modules/ws/lib/receiver.js:437:14)
at Receiver.getData (/home/thewarden/node_modules/ws/lib/receiver.js:367:17)
at Receiver.startLoop (/home/thewarden/node_modules/ws/lib/receiver.js:143:22)
at Receiver._write (/home/thewarden/node_modules/ws/lib/receiver.js:78:10)
at writeOrBuffer (node:internal/streams/writable:395:12)
at Receiver.Writable.write (node:internal/streams/writable:340:10)
at TLSSocket.socketOnData (/home/thewarden/node_modules/ws/lib/websocket.js:900:35)

voiceStateUpdate is an event. To run it, you'll need to use the client.on()function that calls an event, with the correct callback.
Therefore, your code should look like the following:
client.on('voiceStateUpdate', oldState, newState => {
// code here
})
To learn more about the voiceStateUpdate event and its callback: https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-voiceStateUpdate

Related

Problems/errors with Kurento Node.JS examples

I have been trying to write a Node.JS server/client based on the Kurento Media Server, WebRTC conference example. I couldn't get my code to work right, so I thought I would start off by just taking the original example code, setting that up on my dev computer, watching it work, and then slowly making small changes until I got to the way I needed the software to work.
The problem is that I can't get the "webrtc-video-conference-tutorial-kurento" (or the "kurento-one2many-call") example code to work, even if it's completely unmodified. I have tried setting up the current version of Kurento on 2 separate development systems (Ubuntu 18, and Windows 10). Both of them encounter the same errors (code: 40401... Ice Candidate Error).
The exact error text that I am getting is listed below. I would be very greateful for any help you can offer.
Trace: Error: Error adding candidate
at C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-client\lib\KurentoClient.js:361:24
at Object.dispatchCallback [as callback] (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:546:9)
at processResponse (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:667:15)
at RpcBuilder.decode (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:723:5)
at Stream.transportMessage (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:208:10)
at Stream.emit (events.js:315:20)
at Stream.EventEmitter.emit (domain.js:467:12)
at drain (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\through\index.js:36:16)
at Stream.stream.queue.stream.push (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\through\index.js:45:5)
at WebsocketStream.onMessage (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\websocket-stream\index.js:45:15) {
code: 40401,
data: { type: 'ICE_ADD_CANDIDATE_ERROR' }
}
at WebRtcEndpoint.noop (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-client-elements\lib\WebRtcEndpoint.js:35:22)
at callback2 (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\promisecallback\index.js:27:25)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Message received: candidate
Trace: Error: Error adding candidate
at C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-client\lib\KurentoClient.js:361:24
at Object.dispatchCallback [as callback] (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:546:9)
at processResponse (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:667:15)
at RpcBuilder.decode (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:723:5)
at Stream.transportMessage (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-jsonrpc\lib\index.js:208:10)
at Stream.emit (events.js:315:20)
at Stream.EventEmitter.emit (domain.js:467:12)
at drain (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\through\index.js:36:16)
at Stream.stream.queue.stream.push (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\through\index.js:45:5)
at WebsocketStream.onMessage (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\websocket-stream\index.js:45:15) {
code: 40401,
data: { type: 'ICE_ADD_CANDIDATE_ERROR' }
}
at WebRtcEndpoint.noop (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\kurento-client-elements\lib\WebRtcEndpoint.js:35:22)
at callback2 (C:\Dev\X-Platform\WebDev\webrtc-video-conference-example\src\node_modules\promisecallback\index.js:27:25)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Offset error at the launch of a nodejs api application

I'm setting up an api application based on NodeJS and the ORM Sequelize. Everything work fine on my local computer (Windows), but when I want to install this app on a AWS EC2 Linux Instance, I'm encountering this error at the launch of the app :
internal/buffer.js:53
throw new ERR_OUT_OF_RANGE(type || 'offset',
^
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 5. Received 9
at boundsError (internal/buffer.js:53:9)
at Uint8Array.readUInt32LE (internal/buffer.js:109:5)
at Packet.readInt32 (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/packets/packet.js:103:24)
at Function.fromPacket (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/packets/handshake.js:59:32)
at ClientHandshake.handshakeInit (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/commands/client_handshake.js:92:40)
at ClientHandshake.execute (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/commands/command.js:39:22)
at Connection.handlePacket (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/connection.js:449:32)
at PacketParser.Connection.packetParser.p [as onPacket] (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/connection.js:72:12)
at PacketParser.executeStart (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.Connection.stream.on.data (/home/ec2-user/live/CodexAvatarAPI/node_modules/mysql2/lib/connection.js:79:25)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
I've done some research but found nothing useful for now. To my understanding (i'm a beginner with node), the problem seems to be more in the mysql2 component than in the core of NodeJS itself, but I'm not sure where to search exactly.
This error happen juste before synchronizing the database structure with what has been defined in the code. Normally I have to see database update at this point.

MongoDB fails to respond on localhost but works for another node app

I'm working on a new node.js app on an old server I use for dev stuff.
Both apps have the mongo URL specified:
var mongoUri = 'mongodb://localhost/node';
but on startup, the old node.js app works fine, but the new one doesn't. The new one returns the following for node server.js
Error: unable to connect to database at mongodb://localhost/node
at NativeConnection.<anonymous> (/var/www/server/server.js:15:9)
at emitOne (events.js:115:13)
at NativeConnection.emit (events.js:210:7)
at /var/www/server/node_modules/mongoose/lib/connection.js:336:19
at args.push (/var/www/server/node_modules/mongodb/lib/utils.js:403:25)
at /var/www/server/node_modules/mongodb/lib/mongo_client.js:254:21
at connectCallback (/var/www/server/node_modules/mongodb/lib/mongo_client.js:933:5)
at /var/www/server/node_modules/mongodb/lib/mongo_client.js:782:11
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Any thoughts or suggestions would be really appreciated. I've tried everything short of reinstalling mongo at this point :(

Fresh meteor 1.3 on win7 not runnning

I am also posting this on stackoverflow as this is suggested by meteor itself :)
I upgraded my meteor project to Meteor 1.3, and after updating all the proper packages I could not get meteor 1.3 to run. Then I created a fresh project and still get this error I posted below. I also tried to create the simple-todos example shown here https://www.meteor.com/tutorials/blaze/creating-an-app in CMD. Same result.
Windows 7 btw :) Also I have not installed meteorhacks:npm or any other extra packages whatsoever.
http.js:733
throw new TypeError('The header content contains invalid characters');
^
TypeError: The header content contains invalid characters
at ClientRequest.OutgoingMessage.setHeader (http.js:733:13)
at new ClientRequest (http.js:1429:14)
at Object.exports.request (http.js:1899:10)
at Array.stream [as 3] (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:108:74)
at ProxyServer.<anonymous> (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\index.js:80:21)
at Proxy._tryHandleConnections (C:\tools\runners\run-proxy.js:182:20)
at Server.<anonymous> (C:\tools\runners\run-proxy.js:50:12)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2164:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:152:23)
at Socket.socket.ondata (http.js:2022:22)
at TCP.onread (net.js:528:27)
Meteor does startup properly and does not crash until I actually navigate to localhost:3000. The page immediately errors (host not reachable) and meteor crashes with the error shown in my OP.
This problem was related to a specific windows 7 version. Though I don't have specifics anymore, it has been resolved.

Error starting Juggernaut

When I try to start Juggernaut I get this error :
1 Apr 20:21:01 - socket.io ready - accepting connections
node_redis: no callback to send error: ERR unknown command 'subscribe'
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ERR unknown command 'subscribe'
at RedisReplyParser.<anonymous> (/usr/local/lib/node/.npm/redis/0.5.9/packag
e/index.js:84:27)
at RedisReplyParser.emit (events.js:64:17)
at RedisReplyParser.send_error (/usr/local/lib/node/.npm/redis/0.5.9/package
/lib/parser/javascript.js:251:14)
at RedisReplyParser.execute (/usr/local/lib/node/.npm/redis/0.5.9/package/li
b/parser/javascript.js:110:22)
at RedisClient.on_data (/usr/local/lib/node/.npm/redis/0.5.9/package/index.j
s:328:27)
at Socket.<anonymous> (/usr/local/lib/node/.npm/redis/0.5.9/package/index.js
:99:14)
at Socket.emit (events.js:64:17)
at Socket._onReadable (net.js:672:14)
at IOWatcher.onReadable [as callback] (net.js:177:10)
I didnt find anything to help me!
Try upgrading Redis.
It happened to me, and that's what solved it. I'm using Ubuntu, and the one in the package manager isn't an updated version. It needs to be at least version 2.2.1.
Source: From one of the issues posted on the juggernaut github repo.
EDIT: Upon closer inspection, it looks like you were the one who posted the issue on the github repo. I'll just leave this answer here just in case anyone else has the same problem.

Resources