Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help to Debug ECONNRESET when Running in a Deno Environment #3421

Open
Asguho opened this issue Jul 21, 2024 · 0 comments
Open

Help to Debug ECONNRESET when Running in a Deno Environment #3421

Asguho opened this issue Jul 21, 2024 · 0 comments
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@Asguho
Copy link

Asguho commented Jul 21, 2024

Versions

  • mineflayer: 4.20.1
  • server: vanilla 1.20.2
  • deno: 1.45.2

Detailed Description of the Problem

I have been trying to run mineflayer in Deno for a while. When teaching others programming, the setup required in Deno is far less complex than setting up a Node.js environment. I fully understand that mineflayer does not officially support other runtimes such as Deno or Bun, due to the development time and testing needed.

What Have You Tried So Far?

Deno has come a long way, and I have reported multiple inconsistencies from Node.js that prevented me from running mineflayer in Deno. However, I have now run into a dead end with the following code:

import mineflayer from 'npm:mineflayer';

const bot = mineflayer.createBot({
  username: 'bot',
  host: 'localhost',
  version: '1.20.2',
  port: '2555',
});

bot.on('inject_allowed', () => {
  console.log('inject allowed');
});
bot.on('login', () => {
  console.log('Successfully logged in!');
});
bot.on('spawn', () => {
  console.log('Successfully spawned in!');
});

Without a Minecraft server running on localhost:2555, it produces the following error:

inject allowed
Error: connect ECONNREFUSED 127.0.0.1:2555 - Local (undefined:undefined)
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_exceptionWithHostPort (ext:deno_node/internal/errors.ts:217:10)
    at TCPConnectWrap._afterConnect [as oncomplete] (node:net:171:16)
    at TCP.afterConnect (ext:deno_node/internal_binding/connection_wrap.ts:43:11)
    at ext:deno_node/internal_binding/tcp_wrap.ts:302:14
    at eventLoopTick (ext:core/01_core.js:168:7) {
  errno: -4078,
  code: "ECONNREFUSED",
  syscall: "connect",
  address: "127.0.0.1",
  port: 2555,
  localAddress: undefined,
  localPort: undefined
}

However, when I run a local Minecraft server on localhost:2555, it returns the error:

inject allowed
Error: read ECONNRESET
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_errnoException (ext:deno_node/internal/errors.ts:141:10)
    at TCP.onStreamRead [as onread] (ext:deno_node/internal/stream_base_commons.ts:209:20)
    at TCP.#read (ext:deno_node/internal_binding/stream_wrap.ts:245:12)
    at eventLoopTick (ext:core/01_core.js:168:7) {
  errno: -4077,
  code: "ECONNRESET",
  syscall: "read"
}

In my limited understanding, an ECONNRESET occurs when the host refuses the connection for some reason. However, the Minecraft server produces no error messages. Is there a way I can get more information from either Minecraft or mineflayer?

@Asguho Asguho added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

1 participant