TypeError: Cannot read properties of undefined (reading 'members')
This is inside a Raw event
31 Replies
- 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- The provided id is incorrect (copy role ids from context menus, not message mentions)
- The client does not have this structure cached (try fetching instead)
- The client is not yet ready (move the code into any event listener callback)
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
used fetch instead on the guild variable
the id is correct
already tried fetching
code is in a event listener
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
wdym
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Sapphire needs discord.js to work so yes
handling polls
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
oh sorry
this is what
guild
logged
i removed some stuff, the log obviously had that informationUnknown User•8mo ago
Message Not Public
Sign In & Join Server To View
i already trying without fetching but i can try again
it logged
undefined
nowUnknown User•8mo ago
Message Not Public
Sign In & Join Server To View
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn moreUnknown User•8mo ago
Message Not Public
Sign In & Join Server To View
logged
member
and this is what it returned
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
probably, no idea why
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
what are the most common reasons of a guild being undefined
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
- The provided id is incorrect (copy role ids from context menus, not message mentions)
- The client does not have this structure cached (try fetching instead)
- The client is not yet ready (move the code into any event listener callback)
will log ids just incase but i'm sure they are defined
tried logging this but it returned an error:
However I also logged
event.d
, where event.author.id
is definedIf
event.d
is logging the data with the author, shouldn't you be accessing event.d.author.id
instead?you're right, no idea how I didn't realize that
ty for the help