Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.1k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Which package is this bug report for?discord.js Issue descriptionI'm using the agent, but I'm encountering an error. Code sample// Require the necessary discord.js classesconst{ Client, Events, GatewayIntentBits}=require('discord.js');const{ token}=require('./config.json');import{ProxyAgent}from'undici';// Create a new client instanceconstclient=newClient({intents:[GatewayIntentBits.Guilds],rest:{agent:newProxyAgent(`http://127.0.0.1:7890`)}});// When the client is ready, run this code (only once)// We use 'c' for the event parameter to keep it separate from the already defined 'client'client.once(Events.ClientReady,c=>{console.log(`Ready! Logged in as${c.user.tag}`);});// Log in to Discord with your client's tokenclient.login(token); No response Versions
Issue priorityHigh (immediate attention needed) Which partials do you have configured?No Partials Which gateway intents are you subscribing to?Guilds I have tested this issue on a development releaseNo response |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
Replies: 6 comments 1 reply
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@sukbearsuwu Can you catch the error on the login? client.login(token).catch(error=>{console.error(`An error occurred while logging in:${error.message}`);}); |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 2
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
'use strict';varundici=require('undici');// Require the necessary discord.js classesconst{ Client, Events, GatewayIntentBits}=require('discord.js');const{ token}=require('./config.json');// Create a new client instanceconstclient=newClient({intents:[GatewayIntentBits.Guilds],rest:{agent:newundici.ProxyAgent(`http://127.0.0.1:7890`)}});// When the client is ready, run this code (only once)// We use 'c' for the event parameter to keep it separate from the already defined 'client'client.once(Events.ClientReady,c=>{console.log(`Ready! Logged in as${c.user.tag}`);});// Log in to Discord with your client's tokenclient.login(token).catch(error=>{console.error(`An error occurred while logging in:${error.message}`);}); This is the proxy port. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The ProxyAgent you pass is for the REST API connection. Your error is from establishing the WebSocket Gateway connection failing. So not related. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Hi @sukbearsuwu, Lets try fix your client.login() issue. How is your config.json file? Can you send it not showing your token it sould be like this: |
BetaWas this translation helpful?Give feedback.
All reactions
-
I have same issue,how can i resolve this problem ? i can run my service successfully on local,but deploy on linux with network proxy, the terminal throw above the error |
BetaWas this translation helpful?Give feedback.
All reactions
-
You need to configure your host to correctly use the proxy in its network configuration then, not a djs issue. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I have the same problem. Has the host solved it |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #9498 on May 03, 2023 13:28.


