Failed to fetch error in @discordjs/rest
Hi, I'm using @discordjs/rest & discord-api-types, I'm following the documentation, but for some reason, I'm getting Failed to fetch error.
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 staffSo would you give error with stacktrace to better understand the issue?
hmm
does memberData return anything?
none, actually the error is coming from memberData
maybe try to put in rest options makeRequest: fetch
Make sure both memberId and guildId are valid snowflakes
yeah, I checked it. seems to be both Ids are valid
here is my full code
can you elaborate more?
in line 10 after key option in new REST call, so
version: '10'
put another option
makeRequest: fetch
by the way why the heck you either import and require packages?
my godddd, damn. I didn't notice
np just curious
π
but also getting the same error tho π
yeah that's not the issue, just curious
so makeRequest did not help?
It requires 2 params
bru
not the function call
'fetch'
mb
yup, I tried before. but a type err throwing: Type 'string' is not assignable to type '(url: string, init: RequestInit) => Promise<ResponseLike>'.
huh
weird
even docs say that
you can see
makeRequest is a function
https://discord.js.org/docs/packages/rest/main/RESTOptions:Interface#makeRequest
huh
huh v2
maybe send those docs instead of just cropped screenshots then
I've just sent those screenshots from link you've provided
https://discord.js.org/docs/packages/rest/main
Section Send a basic message in an edge environment
well yeah, thats fetch
not 'fetch'
Then why this error showing to me?
pass it a proper fetch
node:fetch
or unidici, or whichever you prefer
worked with undici for me
Okay, let me check.
I'm unable to use undici, coz Next Js is not allowing me to. there are several errors, and node-fetch doesn't work either
actually it's now working, I just had to take this function to a server component, and send the request through β π @InFiNiTy Thank you guys for your time & helpβ€οΈ
D: