Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript FetchError:请求发送到https://discordapp.com/api/v7/gateway/bot 失败,原因:读取EconReset_Javascript_Node.js_Node Modules_Discord.js_Node Fetch - Fatal编程技术网

Javascript FetchError:请求发送到https://discordapp.com/api/v7/gateway/bot 失败,原因:读取EconReset

Javascript FetchError:请求发送到https://discordapp.com/api/v7/gateway/bot 失败,原因:读取EconReset,javascript,node.js,node-modules,discord.js,node-fetch,Javascript,Node.js,Node Modules,Discord.js,Node Fetch,我正在使用node.js模块处理Discord机器人 最近,在使用工作wifi时,启动时(当机器人尝试登录时)出现了一个错误,我认为这是以某种方式配置的,导致其中断 (node:104) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: read ECONNRESET at RequestHandler.exe

我正在使用node.js模块处理Discord机器人

最近,在使用工作wifi时,启动时(当机器人尝试登录时)出现了一个错误,我认为这是以某种方式配置的,导致其中断

(node:104) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: read ECONNRESET
    at RequestHandler.execute (C:\Users\user\Desktop\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:106:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:104) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:104) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
错误是从使用APIRESQUEST的文件
RequestHandler.js
中抛出的 方法,该方法从文件
apirest.js
返回函数的结果,该文件
index.js
返回

该变量是来自https模块的方法的(来自模块)

如果我注释掉('error',function(err){…})上的
req.on('error',function(err){…})然后我得到以下错误:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
    at TLSSocket.socketErrorListener (_http_client.js:391:9)
    at TLSSocket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
我相信它是从Node.js(
internal/stream\u base\u commons.js
)的内部模块中抛出的,我无法对其进行编辑并继续深入跟踪。将不得不编辑和重新编译,这是我不知道怎么做

当我去的时候,我得到了回应:

{"code": 0, "message": "401: Unauthorized"}

我需要帮助了解原始错误的确切原因,以及是否有任何解决方法可以继续运行bot。

我也遇到了同样的问题,我只是检查了bot登录令牌,它已经过时。尝试在Discord开发者门户上生成新的机器人令牌

它在办公网络之外工作吗?@silicakes是的。这与代理或类似的东西有关。因此,在不了解网络设置的情况下,人们只能猜测原因。为了解决这个问题,您应该询问您公司的FW和网络政策。