rustplus.js icon indicating copy to clipboard operation
rustplus.js copied to clipboard

CustomError [ProtocolError]: missing required 'queuedPlayers'

Open cjensenius opened this issue 1 year ago • 7 comments

After the wipe on 3/6, I am encountering an error while using RustPlusPlus and the 2.4.0-2.5.0 version of the library. The issue is encountered when connecting to a modified server (perhaps this is the source of the issue?). The server is not providing the "queuedPlayers" count in the AppInfo structure which causes

/app/node_modules/protobufjs/src/util/minimal.js:266
            return new CustomError(message, properties);
                   ^
CustomError [ProtocolError]: missing required 'queuedPlayers'
    at Object.CustomError [as ProtocolError] (/app/node_modules/protobufjs/src/util/minimal.js:266:20)
    at Type.AppInfo$decode [as decode] (eval at Codegen (/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:92:14)
    at Type.decode_setup [as decode] (/app/node_modules/protobufjs/src/type.js:507:25)
    at Type.AppResponse$decode [as decode] (eval at Codegen (/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:23:19)
    at Type.AppMessage$decode [as decode] (eval at Codegen (/app/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:11:23)
    at WebSocket.<anonymous> (/app/node_modules/@liamcottle/rustplus.js/rustplus.js:78:47)
    at WebSocket.emit (node:events:517:28)
    at WebSocket.emit (node:domain:489:12)
    at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:1203:20)
    at Receiver.emit (node:events:517:28)
    at Receiver.emit (node:domain:489:12)
    at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:550:14)
    at Receiver.getData (/app/node_modules/ws/lib/receiver.js:483:17)
    at Receiver.startLoop (/app/node_modules/ws/lib/receiver.js:172:22)
    at Receiver._write (/app/node_modules/ws/lib/receiver.js:98:10)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Receiver.Writable.write (node:internal/streams/writable:337:10)
    at Socket.socketOnData (/app/node_modules/ws/lib/websocket.js:1297:35)
    at Socket.emit (node:events:517:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:368:12) {
  instance: AppInfo {
    name: 'Friendly Seattle: No KOS | Chill | Noob Friendly',
    headerImage: 'https://friendlyseattlecdn.com/server_header_year4.png',
    url: 'http://friendlyseattle.com',
    map: 'Procedural Map',
    mapSize: 4250,
    wipeTime: 1741288067,
    players: 109,
    maxPlayers: 120,
    seed: 935220591,
    logoImage: '',
    nexus: '',
    nexusZone: ''
  }
}

cjensenius avatar Mar 07 '25 01:03 cjensenius

There are several users reporting the same issue with a variety of different object properties:

  • Member.x
  • Member.y
  • SellOrder.amountInStock
  • SellOrder.itemIsBlueprint
  • SellOrder.currencyIsBlueprint
  • AppInfo.queuedPlayers

cjensenius avatar Mar 07 '25 03:03 cjensenius

FIX: change in file required to optional

C74K avatar Mar 07 '25 09:03 C74K

it seems like FP updated to proto3, see my PR: https://github.com/liamcottle/rustplus.js/pull/77

JulianMa avatar Mar 07 '25 10:03 JulianMa

FIX: change in file required to optional

This works in some cases, but will cause issues in general. No field send does not equal null, but the default proto value for that field in proto3. So receiving

Monument {
 x: 1,
 y: 2
}

should be read as

Monument {
 x: 1,
 y: 2
z: 0
}

Thats actually something which is happening: https://github.com/alexemanuelol/rustplusplus/issues/408

JulianMa avatar Mar 07 '25 11:03 JulianMa

@liamcottle If you get a change could you review PR 77 please, currently this library is broken without it.

For anyone reading this in the meantime you can change your package.json to use Julian's fork with:

  "dependencies": {
    "@liamcottle/push-receiver": "^0.0.3",
    "@liamcottle/rustplus.js": "git+https://github.com/JulianMa/rustplus.js.git#9f87ea17f3d330c23615757130855590ad84ac22"
  },

nerif-tafu avatar Mar 29 '25 15:03 nerif-tafu

@liamcottle If you get a change could you review PR 77 please, currently this library is broken without it.

For anyone reading this in the meantime you can change your package.json to use Julian's fork with:

  "dependencies": {
    "@liamcottle/push-receiver": "^0.0.3",
    "@liamcottle/rustplus.js": "git+https://github.com/JulianMa/rustplus.js.git#9f87ea17f3d330c23615757130855590ad84ac22"
  },

update your bot to 1.21 older versions are no longer supported

C74K avatar Mar 30 '25 17:03 C74K

@liamcottle If you get a change could you review PR 77 please, currently this library is broken without it. For anyone reading this in the meantime you can change your package.json to use Julian's fork with:

  "dependencies": {
    "@liamcottle/push-receiver": "^0.0.3",
    "@liamcottle/rustplus.js": "git+https://github.com/JulianMa/rustplus.js.git#9f87ea17f3d330c23615757130855590ad84ac22"
  },

update your bot to 1.21 older versions are no longer supported

I don't have much hope of liam returning, which is totally fine. Projects like these take time and there is other stuff in life. I talked to alex and he's using my fork for rustplusplus for now, he's switching to https://github.com/alexemanuelol/rustplus-ts anyway, so we can keep updating the proto there, when the migration is done.

JulianMa avatar Mar 31 '25 08:03 JulianMa