Skip to content

TypeError: Cannot read properties of null (reading 'supportFeature') when using the API wrong. #1394

@mk-pmb

Description

@mk-pmb

[x] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: 1.57.0
  • server: 25w14craftmine "Open to LAN"
  • node: 22.11.0 (docker image node:22)

Detailed description of a problem

/app/devel.@/node-minecraft-protocol/src/client.js:33
    this._supportFeature = mcData.supportFeature
                                  ^

TypeError: Cannot read properties of null (reading 'supportFeature')
    at new Client (/app/devel.@/node-minecraft-protocol/src/client.js:33:35)
    at file:///app/bot.mjs:13:17
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.11.0

Current code

Edit: Actually this happens with even just

import mcrProto from 'minecraft-protocol';
const McrClient = mcrProto.Client;
(new McrClient()).connect();

Expected behavior

A more helpful error message is printed. Ideally one that says I'm using the API wrong and should read the current version's hello world example.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions