BUG: TypeError: Cannot read property 'get' of undefined
Question
Error:
(node:206) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
(node:206) 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 handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:206) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
\\\\\\\\\\\\\\
Code :
client.on("guildMemberAdd", async member => {
const cachedInvites = guildInvites.cache.get(member.guild.id);
const newInvites = await member.guild.fetchInvites();
guildInvites.set(member.guild.id, newInvites);
try{
const usedInvite = newInvites.cache.find(inv => cachedInvites.cache.get(inv.code).uses < inv.uses);
const joinChannel = member.guild.channels.cache.get(channel => channel.id === "840700441712263168")
if(joinChannel) {
joinChannel.send(`**><:Discord:831221457555554366>**Welcome ${member} to our server Fiery Foxes E-Sports.**
><:emoji_101:831317753204965407>**We hope you enjoy your time with us.**
><:emoji_100:831317050550779914>**Please don't forget to read** #guidelines
><:fiery:830542549843443713>**Invited by : ${usedInvite.inviter} **
><:_hf_:826503267479322727>**Member count : ${member.guild.memberCount}**`)
joinChannel.send("https://media.discordapp.net/attachments/806649507067723777/843579501413269564/10_3EA7AB3.gif").catch(err => console.log(err))
}
}
catch(err) {console.log(err);}
})Answers (1)
Please follow the issue template
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1520
[Bug] On this.components() Error : Uncaught TypeError: Cannot read property 'each' of undefined
Get below error for this.components() not sure if it is bug or I am doing something wrong. Uncaught TypeError: Cannot read property 'each'...
Issue #6040
BUG: Cannot read properties of undefined (reading 'lastComponent')
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Version 127.0.6533.89 (Official Build) (64...
Issue #3075
BUG: Unhandled Rejection (TypeError): i.classList is undefined
Hi. I updated GrapesJS to its current version 0.16.22 and I get an error on the callback function: editor.on("component:add", (model) => {...
Issue #5386
BUG: Cannot read properties of undefined (reading 'width')
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge Reproducible demo link NA Describe th...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.