Skip to content

UnhandledPromiseRejectionWarning: TypeError: prism.VolumeTransformer16LE is not a constructor #3102

@moonstar-x

Description

@moonstar-x

Please describe the problem you are having in as much detail as possible:
Trying to join a voice channel throws the following error:


(node:49792) UnhandledPromiseRejectionWarning: TypeError: prism.VolumeTransformer16LE is not a constructor
    at AudioPlayer.playOpusStream (/Users/moonstar/Desktop/discord-tts-bot/node_modules/discord.js/src/client/voice/player/BasePlayer.js:80:39)
    at VoiceConnection.play (/Users/moonstar/Desktop/discord-tts-bot/node_modules/discord.js/src/client/voice/util/PlayInterface.js:75:28)
    at VoiceConnection.onSessionDescription (/Users/moonstar/Desktop/discord-tts-bot/node_modules/discord.js/src/client/voice/VoiceConnection.js:445:29)
    at VoiceWebSocket.emit (events.js:197:13)
    at VoiceWebSocket.onPacket (/Users/moonstar/Desktop/discord-tts-bot/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:187:14)
    at VoiceWebSocket.onMessage (/Users/moonstar/Desktop/discord-tts-bot/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:138:19)
    at WebSocket.onMessage (/Users/moonstar/Desktop/discord-tts-bot/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:197:13)
    at Receiver.receiverOnMessage (/Users/moonstar/Desktop/discord-tts-bot/node_modules/ws/lib/websocket.js:744:20)
    at Receiver.emit (events.js:197:13)
(node:49792) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handledwith .catch(). (rejection id: 1)
(node:49792) [DEP0018] DeprecationWarning: Unhandled promise rejectionsare deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Include a reproducible code sample here, if possible:
The "connecting to a voice channel" code example on the docs is enough to run into this error.

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('message', async message => {
  // Voice only works in guilds, if the message does not come from a guild,
  // we ignore it
  if (!message.guild) return;

  if (message.content === '/join') {
    // Only try to join the sender's voice channel if they are in one themselves
    if (message.member.voice.channel) {
      const connection = await message.member.voice.channel.join();
    } else {
      message.reply('You need to join a voice channel first!');
    }
  }
});

client.login("discord token");

Further details:

  • discord.js version: master branch (6aa792f)
  • Node.js version: v11.10.0
  • Operating system: Happens on Ubuntu Server 18.04 and macOS Mojave 10.14.2, haven't tested on Windows but it's most likely platform independent.
  • Priority this issue should have – please be realistic and elaborate if possible: medium?
  • I have also tested the issue on latest master, commit hash: 6aa792f

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions