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

1.20.4 Login event never triggered on Node 18 #1289

Open
Opisek opened this issue Feb 27, 2024 · 19 comments
Open

1.20.4 Login event never triggered on Node 18 #1289

Opisek opened this issue Feb 27, 2024 · 19 comments

Comments

@Opisek
Copy link

Opisek commented Feb 27, 2024

Versions

  • minecraft-protocol: 1.47.0
  • node: 18.19.1

Detailed description of a problem

The protocol is broken on Node 18. Works fine on Node 20. The simplest way to reproduce it is to simply listen for a login event.

Current code

import { createServer } from "minecraft-protocol";

const options = {
   host: "127.0.0.1",
   motd: "test",
   port: 25565,
   maxPlayers: 20,
   version: "1.20.4"
}

const srv = createServer(options);

srv.on("login", client => {
   console.log("join");
});

Expected behavior

"join" is printed on the console when a client tries to join the server.

Actual behavior

Nothing is printed and one of the following happens

  • Client sees "Disconnected"
  • Client sees "IndexOutOfBounds"
  • Client sees "codecCorruptedFrameException"

Furthermore, the server may receive the following error (does not always happen either):

Disconnecting client because error Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}

Additional context

I'd like to ask you to adjust the supported engine value for this library to disclude older versions of Node, if this issue can't be fixed easily.

@rom1504
Copy link
Member

rom1504 commented Feb 27, 2024

Please enable debug mode and post packet log

@Opisek
Copy link
Author

Opisek commented Feb 27, 2024

I'm also experiencing the same thing on Node 20, but I couldn't reproduce it in a testing environment yet.
The Node 18 reproduction works every time for me, though.

  minecraft-protocol read packet handshaking.set_protocol +0ms
  minecraft-protocol {
  minecraft-protocol   "protocolVersion": 765,
  minecraft-protocol   "serverHost": "kubernetes.docker.internal",
  minecraft-protocol   "serverPort": 25565,
  minecraft-protocol   "nextState": 2
  minecraft-protocol } +1ms
  minecraft-protocol read packet login.login_start +13ms
  minecraft-protocol {
  minecraft-protocol   "username": "Opisek",
  minecraft-protocol   "playerUUID": "ecbc77f4-0f18-4ec2-9653-ce51e560a4eb"
  minecraft-protocol } +0ms
  minecraft-protocol writing packet login.encryption_begin +152ms
  minecraft-protocol {
  minecraft-protocol   serverId: '817abf9c',
  minecraft-protocol   publicKey: <Buffer 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 9a a5 23 83 21 14 01 e4 85 78 1d 03 a1 f7 dc b9 99 00 5c 70 51 ... 112 more bytes>,
  minecraft-protocol   verifyToken: <Buffer 51 76 b0 70>
  minecraft-protocol } +0ms
  minecraft-protocol read packet login.encryption_begin +233ms
  minecraft-protocol {
  minecraft-protocol   "sharedSecret": {
  minecraft-protocol     "type": "Buffer",
  minecraft-protocol     "data": [
  minecraft-protocol       96,
  minecraft-protocol       41,
  minecraft-protocol       15,
  minecraft-protocol       58,
  minecraft-protocol       184,
  minecraft-protocol       6,
  minecraft-protocol       234,
  minecraft-protocol       106,
  minecraft-protocol       89,
  minecraft-protocol       137,
  minecraft-protocol       53,
  minecraft-protocol       201,
  minecraft-protocol       36,
  minecraft-protocol       97,
  minecraft-protocol       9,
  minecraft-protocol       6,
  minecraft-protocol       8,
  minecraft-protocol       184,
  minecraft-protocol       215,
  minecraft-protocol       228,
  minecraft-protocol       168,
  minecraft-protocol       96,
  minecraft-protocol       190,
  minecraft-protocol       45,
  minecraft-protocol       80,
  minecraft-protocol       66,
  minecraft-protocol       116,
  minecraft-protocol       255,
  minecraft-protocol       224,
  minecraft-protocol       129,
  minecraft-protocol       62,
  minecraft-protocol       97,
  minecraft-protocol       248,
  minecraft-protocol       164,
  minecraft-protocol       200,
  minecraft-protocol       193,
  minecraft-protocol       225,
  minecraft-protocol       154,
  minecraft-protocol       8,
  minecraft-protocol       141,
  minecraft-protocol       159,
  minecraft-protocol       120,
  minecraft-protocol       183,
  minecraft-protocol       59,
  minecraft-protocol       249,
  minecraft-protocol       218,
  minecraft-protocol       253,
  minecraft-protocol       208,
  minecraft-protocol       213,
  minecraft-protocol       193,
  minecraft-protocol       144,
  minecraft-protocol       107,
  minecraft-protocol       104,
  minecraft-protocol       140,
  minecraft-protocol       243,
  minecraft-protocol       254,
  minecraft-protocol       47,
  minecraft-protocol       50,
  minecraft-protocol       4,
  minecraft-protocol       169,
  minecraft-protocol       239,
  minecraft-protocol       8,
  minecraft-protocol       164,
  minecraft-protocol       112,
  minecraft-protocol       94,
  minecraft-protocol       13,
  minecraft-protocol       63,
  minecraft-protocol       35,
  minecraft-protocol       180,
  minecraft-protocol       12,
  minecraft-protocol       37,
  minecraft-protocol       179,
  minecraft-protocol       122,
  minecraft-protocol       40,
  minecraft-protocol       119,
  minecraft-protocol       1,
  minecraft-protocol       64,
  minecraft-protocol       164,
  minecraft-protocol       78,
  minecraft-protocol       88,
  minecraft-protocol       151,
  minecraft-protocol       225,
  minecraft-protocol       99,
  minecraft-protocol       63,
  minecraft-protocol       4,
  minecraft-protocol       156,
  minecraft-protocol       18,
  minecraft-protocol       173,
  minecraft-protocol       60,
  minecraft-protocol       70,
  minecraft-protocol       44,
  minecraft-protocol       33,
  minecraft-protocol       142,
  minecraft-protocol       25,
  minecraft-protocol       242,
  minecraft-protocol       238,
  minecraft-protocol       14,
  minecraft-protocol       26,
  minecraft-protocol       176,
  minecraft-protocol       8,
  minecraft-protocol       231,
  minecraft-protocol       184,
  minecraft-protocol       58,
  minecraft-protocol       130,
  minecraft-protocol       50,
  minecraft-protocol       203,
  minecraft-protocol       139,
  minecraft-protocol       163,
  minecraft-protocol       210,
  minecraft-protocol       157,
  minecraft-protocol       169,
  minecraft-protocol       212,
  minecraft-protocol       96,
  minecraft-protocol       119,
  minecraft-protocol       77,
  minecraft-protocol       45,
  minecraft-protocol       201,
  minecraft-protocol       56,
  minecraft-protocol       69,
  minecraft-protocol       136,
  minecraft-protocol       179,
  minecraft-protocol       84,
  minecraft-protocol       59,
  minecraft-protocol       57,
  minecraft-protocol       28,
  minecraft-protocol       216,
  minecraft-protocol       188,
  minecraft-protocol       116
  minecraft-protocol     ]
  minecraft-protocol   },
  minecraft-protocol   "verifyToken": {
  minecraft-protocol     "type": "Buffer",
  minecraft-protocol     "data": [
  minecraft-protocol       73,
  minecraft-protocol       187,
  minecraft-protocol       146,
  minecraft-protocol       205,
  minecraft-protocol       142,
  minecraft-protocol       135,
  minecraft-protocol       28,
  minecraft-protocol       253,
  minecraft-protocol       37,
  minecraft-protocol       109,
  minecraft-protocol       95,
  minecraft-protocol       178,
  minecraft-protocol       188,
  minecraft-protocol       141,
  minecraft-protocol       90,
  minecraft-protocol       132,
  minecraft-protocol       99,
  minecraft-protocol       237,
  minecraft-protocol       33,
  minecraft-protocol       163,
  minecraft-protocol       238,
  minecraft-protocol       21,
  minecraft-protocol       74,
  minecraft-protocol       234,
  minecraft-protocol       7,
  minecraft-protocol       78,
  minecraft-protocol       234,
  minecraft-protocol       207,
  minecraft-protocol       240,
  minecraft-protocol       128,
  minecraft-protocol       210,
  minecraft-protocol       24,
  minecraft-protocol       157,
  minecraft-protocol       23,
  minecraft-protocol       45,
  minecraft-protocol       195,
  minecraft-protocol       34,
  minecraft-protocol       176,
  minecraft-protocol       48,
  minecraft-protocol       253,
  minecraft-protocol       198,
  minecraft-protocol       228,
  minecraft-protocol       86,
  minecraft-protocol       75,
  minecraft-protocol       186,
  minecraft-protocol       28,
  minecraft-protocol       8,
  minecraft-protocol       192,
  minecraft-protocol       152,
  minecraft-protocol       68,
  minecraft-protocol       182,
  minecraft-protocol       96,
  minecraft-protocol       249,
  minecraft-protocol       92,
  minecraft-protocol       107,
  minecraft-protocol       182,
  minecraft-protocol       98,
  minecraft-protocol       219,
  minecraft-protocol       99,
  minecraft-protocol       177,
  minecraft-protocol       114,
  minecraft-protocol       57,
  minecraft-protocol       100,
  minecraft-protocol       55,
  minecraft-protocol       11,
  minecraft-protocol       61,
  minecraft-protocol       45,
  minecraft-protocol       241,
  minecraft-protocol       69,
  minecraft-protocol       168,
  minecraft-protocol       183,
  minecraft-protocol       129,
  minecraft-protocol       91,
  minecraft-protocol       56,
  minecraft-protocol       175,
  minecraft-protocol       54,
  minecraft-protocol       26,
  minecraft-protocol       121,
  minecraft-protocol       231,
  minecraft-protocol       78,
  minecraft-protocol       85,
  minecraft-protocol       166,
  minecraft-protocol       73,
  minecraft-protocol       173,
  minecraft-protocol       158,
  minecraft-protocol       107,
  minecraft-protocol       213,
  minecraft-protocol       67,
  minecraft-protocol       198,
  minecraft-protocol       67,
  minecraft-protocol       245,
  minecraft-protocol       182,
  minecraft-protocol       30,
  minecraft-protocol       158,
  minecraft-protocol       114,
  minecraft-protocol       178,
  minecraft-protocol       96,
  minecraft-protocol       53,
  minecraft-protocol       222,
  minecraft-protocol       131,
  minecraft-protocol       169,
  minecraft-protocol       128,
  minecraft-protocol       107,
  minecraft-protocol       119,
  minecraft-protocol       40,
  minecraft-protocol       126,
  minecraft-protocol       85,
  minecraft-protocol       15,
  minecraft-protocol       234,
  minecraft-protocol       150,
  minecraft-protocol       251,
  minecraft-protocol       154,
  minecraft-protocol       237,
  minecraft-protocol       162,
  minecraft-protocol       202,
  minecraft-protocol       5,
  minecraft-protocol       6,
  minecraft-protocol       214,
  minecraft-protocol       35,
  minecraft-protocol       122,
  minecraft-protocol       157,
  minecraft-protocol       214,
  minecraft-protocol       167,
  minecraft-protocol       82,
  minecraft-protocol       162,
  minecraft-protocol       193,
  minecraft-protocol       103,
  minecraft-protocol       207
  minecraft-protocol     ]
  minecraft-protocol   }
  minecraft-protocol } +0ms
  minecraft-protocol writing packet login.disconnect +2ms
  minecraft-protocol { reason: '{"text":"DidNotEncryptVerifyTokenProperly"}' } +0ms

@rom1504
Copy link
Member

rom1504 commented Feb 27, 2024

minecraft-protocol { reason: '{"text":"DidNotEncryptVerifyTokenProperly"}' } +0ms

this is clearly the problem

@rom1504
Copy link
Member

rom1504 commented Feb 27, 2024

@Opisek can you reproduce in a vanilla server?

@Opisek
Copy link
Author

Opisek commented Feb 29, 2024

No I cannot. The issue is only with node-minecraft-protocol based server, I can join any other server just fine. The issue persisted on two machines I tried for a server and two different minecraft users from different countries.

For context, here's my production code: https://github.com/Opisek/mc-paper-docker/blob/bug/dynmap/src/modules/mock.ts
This one doesn't work on both Node 18 and Node 20.

The example in my original post only seems to work in Node 20, but not Node 18.

@rom1504
Copy link
Member

rom1504 commented Feb 29, 2024

Are you using online login?

@Opisek
Copy link
Author

Opisek commented Feb 29, 2024

Yes, everything worked fine a few weeks ago in node-minecraft-protocol 1.44.0 and minecraft 1.20.1.

@Opisek
Copy link
Author

Opisek commented Feb 29, 2024

May I know what Node version you use for testing?

Here's how node-minecraft-protocol behaves on my systems depending on the Node version:
v18.19.1 (npm v10.2.4): Doesn't work
v20.10.0 (npm v10.2.3): Works
v20.11.1 (npm v10.2.4): Doesn't work
v20.11.1 (npm v10.2.3): Doesn't work

(Tested on both a Debian and a Windows server with both the example code in my original post and the linked production code.)

@rom1504
Copy link
Member

rom1504 commented Feb 29, 2024

https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/.github/workflows/ci.yml#L20 we use node 18

However we disabled the online login tests a while back because it did not work well with the throttling limits on Mojang auth #372

Might be time to revisit this...

@Opisek
Copy link
Author

Opisek commented Feb 29, 2024

I'll see if I can run it on the one stable version I could find, otherwise I'll disable online login. Thanks for looking into it and please keep me updated.

@Hyphrio
Copy link

Hyphrio commented Mar 31, 2024

Weirdly enough on my testing, Deno 1.42.0 (on node compat) emits the Login event correctly.
But Node 20.11.1 does not.

Tho it seems that client.end is broken on both due to including backslashes on the message for 1.20.2 and above but this could be another issue Turns out this was already filed

Could this be due to an ABI change in Node?

@Khaogamermain01
Copy link

I was trying to make a proxy and suddenly could not join any Minecraft-Protocol Server so I tested multiple versions of Minecraft such as 1.12.2, 1.16.5, and 1.19.2 and none of them worked.

When I join the server from the client it says:

  • Logging In
  • Encrypting
  • Disconnected

After I found this GitHub issue I tried v20.10.0 and it worked.

Node v18.0.0: Yes
Node v18.20.2: No
Node v19.0.0: Yes
Node v19.9.0: No
Node v20.0.0: Yes
Node v20.10.0: Yes
Node v20.12.2: No
Node v21.0.0: Yes
Node v21.7.3: No (Error)
DeprecationWarning: The 'punycode' module is deprecated.

Internal Exception: io.netty.handler.codec.DecoderException:
java.lang.IndexOutOfBoundsException: Index: 94, Size: 5

Node v22.0.0: No

@Khaogamermain01
Copy link

Any update on this?

@ytcalifax
Copy link

Is the library still being actually updated? This seems to have been an issue for months with no commits trying to fix it.

@qwqtoday
Copy link

qwqtoday commented Jun 2, 2024

Is the library still being actually updated? This seems to have been an issue for months with no commits trying to fix it.

I hope it is, I recently made a pr that fixs joining 1.20.6 servers with viaversion in prismarine-registry. It have been 2 weeks and it haven't been merged. It seems that they Maybe the maintainers are just busy at something right now.

Be patient.

@ytcalifax
Copy link

I am (i have been postponing doing the project I have in mind for quite a while already), it’s just starting to look like this library is either not being updated anymore or there are not enough trusted maintainers that can keep up with the bugs (this bug is now several months old and is a breaking one) or even merge the pull requests.

@qwqtoday
Copy link

qwqtoday commented Jun 2, 2024

I am (i have been postponing doing the project I have in mind for quite a while already), it’s just starting to look like this library is either not being updated anymore or there are not enough trusted maintainers that can keep up with the bugs (this bug is now several months old and is a breaking one) or even merge the pull requests.

I had an idea of forking all prismarinejs projects to another GitHub organization to get my wanted changes to be merged. Most of the prismarinejs projects doesn't really need to have to update once a while, usually they are just classes and types for the core projects. Because of this, they didn't really have to add many maintainers for most of the projects. But I agree with you that they didn't keep up with the bugs recently.

@extremeheat
Copy link
Member

Is the library still being actually updated? This seems to have been an issue for months with no commits trying to fix it.

Indeed, this is normal for open source projects; you don't just push commits for the sake of doing commits to appear active. That doesn't mean there are no maintainers, it just means there are no PRs to merge.

If you (or someone) make a PR to fix it then there is a discussion about not merging it, then we can talk about why the PR isn't merged, but at this time there is no PR to fix it.

There are indeed no maintainers here being paid to monitor and fix your bugs, and we are not sponsored by Microsoft or some other org. The commits done here are done by volunteers and will be done as soon as someone has time and is interested in doing a PR. You are always free to fork, but that obviously won't fix bugs unless you write the code to fix them yourself.

Any update on this?

Could be related to #1293

@rom1504
Copy link
Member

rom1504 commented Jun 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants