Unable to upload emoji: TypeError: terminated

Hello, when I try to upload emojis using attachment, it result as this:
TypeError: terminated
at Fetch.onAborted (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:2034:49)
at Fetch.emit (node:events:513:28)
at Fetch.terminate (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:93:10)
at /root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:506:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_ARG_TYPE]: The "stream" argument must be an instance of Stream. Received an instance of ReadableStream
at new NodeError (node:internal/errors:400:5)
at eos (node:internal/streams/end-of-stream:66:11)
at fetchFinale (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:1093:5)
at mainFetch (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:760:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
}
TypeError: terminated
at Fetch.onAborted (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:2034:49)
at Fetch.emit (node:events:513:28)
at Fetch.terminate (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:93:10)
at /root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:506:30
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_ARG_TYPE]: The "stream" argument must be an instance of Stream. Received an instance of ReadableStream
at new NodeError (node:internal/errors:400:5)
at eos (node:internal/streams/end-of-stream:66:11)
at fetchFinale (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:1093:5)
at mainFetch (/root/DiscordBot/Holo/node_modules/discord.js/node_modules/undici/lib/web/fetch/index.js:760:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_ARG_TYPE'
}
}
The code:
const upload = interaction.options.getAttachment('image');
const name = interaction.options.getString('name');

try {
const emoji = await interaction.guild.emojis.create({
attachment: upload.attachment,
name: name,
});
const upload = interaction.options.getAttachment('image');
const name = interaction.options.getString('name');

try {
const emoji = await interaction.guild.emojis.create({
attachment: upload.attachment,
name: name,
});
The code work locally, but not in production. I have no idea what caused that issue. Discord.js version: ^14.15.3 Node.js version: v20.15.0 Both Discord.js version and Node.js are same between local and production.
12 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Amgelo
Amgelo6mo ago
The "stream" argument must be an instance of Stream. Received an instance of ReadableStream
update your node version (make sure it's 20) you could try logging process.version
RyansHDs
RyansHDsOP6mo ago
Yes, it's node v20.15.0
Amgelo
Amgelo6mo ago
how are you checking that?
RyansHDs
RyansHDsOP6mo ago
I haven't do the process.version, but when I did node -v it result v20.15.0
RyansHDs
RyansHDsOP6mo ago
No description
Amgelo
Amgelo6mo ago
just in case try logging it
RyansHDs
RyansHDsOP6mo ago
Alright It showed as v18.13.0 apparently.
Amgelo
Amgelo6mo ago
how are you starting the bot?
RyansHDs
RyansHDsOP6mo ago
Am currently using pm2 to keep the bot active when the shell are closed
Amgelo
Amgelo6mo ago
you could do that with screen or tmux though it's not really discord.js related anymore if you need further help you should ask in #other-js-ts
RyansHDs
RyansHDsOP6mo ago
Alright, I found the solution by doing pm2 update so it can get the latest node. Thanks for the help. I will mark the post as solved.
Want results from more Discord servers?
Add your server