TypeError [InvalidType]: Supplied parameter is not a User nor a Role.
Hey everyone, running into a weird error trying to create a channel with specific permissions.
The parentGuild object was fetched using client.guilds.fetch() (part of a class thats constructed at startup). options.memberId is also 100% a user snowflake, its being passed in via an api route but it's copied right from the discord client. I've also tried with
id: "snowflake"
to no avail. Can anyone figure out whats going on.12 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!
node v21.7.3
make sure options.memberId is a string and not a number
its a string yes
Full Stack Trace
what does logging it says
first line is
console.log(typeof options.memberId)
when using an id directly for an overwrite (particularly for uncached structures), you'll want to specify the
type
of the overwrite
that being OverwriteType.Member
in this caseFixed, thanks.
Docs examples show a memberId being used without the optional type parameter (below), worth opening an issue for?
probably not, the example shows using the id for a cached structure
Cached structure as in the cached guild?
no, the cached author
oh, right, okay
That makes sense, thank you