Skip to content

When querying 1.21.1 Servers, response contains unexpected characters. #4

@Mx772

Description

@Mx772

When doing a simple query like:

import mc from "minecraftstatuspinger";

// All The Mods 10 - 1.21.1
let result = await mc.lookup({ host: "10.g.akliz.net" });
console.log(result);

Getting the error:

undefined:1
{
    "favicon": "LongBase64",
    "isModded": true,
    "description": "A Minecraft Server",
    "players": {
        "max": 20,
        "online": 6,
        "sample": [
        ]
    },
    "version": {
        "name": "1.21.1",
        "protocol": 767
    },
    "preventsChatReports": true
}V{
    "releaseType": "unknown",
    "projectId": 925200,
    "name": "All The Mods 10",
    "version": "2.36"
}

SyntaxError: Unexpected non-whitespace character after JSON at position 6108 (line 1 column 6109)
    at JSON.parse (<anonymous>)
    at new ServerStatus (file:////node_modules/.pnpm/minecraftstatuspinger@1.2.1/node_modules/minecraftstatuspinger/dist/types.js:29:36)
    at Socket.<anonymous> (file:////node_modules/.pnpm/minecraftstatuspinger@1.2.1/node_modules/minecraftstatuspinger/dist/index.js:64:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Note the 'V' between json objects.

Doing the same for a 1.20.1 server returns valid results like:

import mc from "minecraftstatuspinger";

// All the Mods 9  - 1.20.1
let result = await mc.lookup({ host: "atm9nf.g.akliz.net" });
console.log(result);    

I was able to replicate it on other versions of node as well.

Tested:

Node.js v22.8.0
Node.js v18.20.7
Node.js v22.14.0

I haven't touched node in quite a bit, so I could 100% be doing something wrong here. But the fact it breaks on the newer versions makes me assume it's something like the response changing as you demonstrated here:
https://pinger.floppa.hair/responses/

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions