Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. globallyltd
  3. Posts
  • Profile
  • More
    • Continue chat with globallyltd
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

Posts made by globallyltd

RE: When running server: "TypeError: Cannot read property 'types' of undefined"

I am seeing this relevant post but am having trouble figuring out exactly what was changed:

https://discuss.colyseus.io/topic/298/types-of-undefined-in-reflection-js-error-in-unity/1

posted in Questions & Help • 13 Apr 2020, 00:23
When running server: "TypeError: Cannot read property 'types' of undefined"

Hi, I'm running into a persistent error when trying to run a colyseus server. It starts up fine, but when I try to connect to the server from the client, I get the following error:

> ts-node src/index.ts

[gltd-server] running environment:  local
~you are now globally limited~
[gltd-server] Listening on 2657
TypeError: Cannot read property 'types' of undefined
    at Function.Reflection.encode (/Users/brianableson/gltd/globally.ltd/server/node_modules/@colyseus/schema/src/Reflection.ts:96:47)
    at SchemaSerializer.handshake (/Users/brianableson/gltd/globally.ltd/server/node_modules/colyseus/lib/serializer/SchemaSerializer.js:57:70)
    at Club.<anonymous> (/Users/brianableson/gltd/globally.ltd/server/node_modules/colyseus/lib/Room.js:292:136)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/brianableson/gltd/globally.ltd/server/node_modules/colyseus/lib/Room.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

I am closely following this example.

Here is my current package.json file:

{
  "name": "globally-ltd-game-server",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start-local": "NODE_ENV=local onchange 'src/**.ts' -i -d 1000 -- ts-node src/index.ts",
    "start-ts": "ts-node src/index.ts",
    "start": "ts-node src/index.ts",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/cors": "0.0.33",
    "@types/express": "^4.17.6",
    "@types/node": "^13.11.1",
    "onchange": "^3.3.0",
    "ts-node": "^7.0.1",
    "typescript": "^3.8.3"
  },
  "dependencies": {
    "colyseus": "^0.12.6",
    "cors": "^2.8.1",
    "express": "^4.14.0",
    "onchange": "^3.3.0"
  }
}

I'm new to typescript, so i'm guessing this is a noobish problem but i'm having trouble googling for the error. Thanks so much for your help in advance!

posted in Questions & Help • 13 Apr 2020, 00:15

© 2023 Endel Dreyer