Replies: 6 comments 1 reply
{{title}}
{{editor}}'s edit
{{editor}}'s edit
-
@sukbearsuwu Can you catch the error on the login? client.login(token).catch(error => {
console.error(`An error occurred while logging in: ${error.message}`);
}); |
Beta Was this translation helpful? Give feedback.
{{title}}
{{editor}}'s edit
{{editor}}'s edit
-
'use strict';
var undici = require('undici');
// Require the necessary discord.js classes
const { Client, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds], rest:{ agent: new undici.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 token
client.login(token).catch(error => {
console.error(`An error occurred while logging in: ${error.message}`);
}); This is the proxy port. |
Beta Was this translation helpful? Give feedback.
-
The ProxyAgent you pass is for the REST API connection. Your error is from establishing the WebSocket Gateway connection failing. So not related. |
Beta Was this translation helpful? Give feedback.
{{title}}
{{editor}}'s edit
{{editor}}'s edit
-
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:
|
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I have the same problem. Has the host solved it |
Beta Was this translation helpful? Give feedback.
{{title}}
{{editor}}'s edit
{{editor}}'s edit
-
Which package is this bug report for?
discord.js
Issue description
I'm using the agent, but I'm encountering an error.
Code sample
No response
Versions
npm ls discord.js
or another package)node --version
)npm ls typescript
if you use it)Issue priority
High (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 release
No response
Beta Was this translation helpful? Give feedback.
All reactions