-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I have a Discord Bot and on my Windows 10 64x PC it works fine, but on my VM Debian 10 Server i got the following error and I dont know why.
If i run on my computer(Windows 10 VSC Debugger) the
but on my VM (Debian 10)
tbh i dont know why it works on my pc fine and on my server i got the error with the same packages and versions
Error:
/home/lennart/Discordbots/v2/node_modules/node-fetch/lib/index.js:272
return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
^
FetchError: invalid json response body at https://karmatop.de/addon/pxl-api.php?name=L3nnart_ reason: Unexpected token < in JSON at position 0
at /home/lennart/Discordbots/v2/node_modules/node-fetch/lib/index.js:272:32
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'invalid-json'
}
Example Code
const url = `https://karmatop.de/addon/pxl-api.php?name=` + spieler; //spieler is a variable/argument from the discord bot, for example "L3nnart_"
fetch(url, {
method: "GET",
headers: {
Accept: "application/json",
},
})
Your Environment
software | version |
---|---|
node-fetch | 2.6.1 |
node | 16.8 |
npm | 7.21.0 |
Operating System | Deabian/Windows |