question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Uncaught TypeError: Cannot read property '_schema' of undefined" when reloading tab with 0.10.2

See original GitHub issue

Steps to Reproduce (for bugs)

  1. Connect a client on Chrome
  2. Connect a client on Firefox (everything works fine at this point and the map is loaded correctly and players see each other and can move)
  3. Reload one of the tab (either Chrome or Firefox)
  4. The reloaded tabs throws the following error, and the state is corrupted (no more listeners working)
   at _loop_1 (annotations.js:175)
   at _.Schema.decode (annotations.js:351)
   at _loop_1 (annotations.js:320)
   at _.Schema.decode (annotations.js:351)
   at SchemaSerializer.setState (SchemaSerializer.js:15)
   at Room.setState (Room.js:177)
   at Room.onMessageCallback (Room.js:165)
   at Connection.onMessageCallback (index.js:118)

This is how I initialize my listeners to the Colyseus room events:

this.colyseusClient = new Client(API_WS_URL)
this.colyseusRoom = this.colyseusClient.join(ROOM_NAME)
this.colyseusRoom.onJoin.add(() => {

  // Walls
  this.colyseusRoom.state.walls.onAdd = (wall, key) => this.handleWallAdd(key, wall)

  // Players
  this.colyseusRoom.state.players.onAdd = (player, key) => this.handlePlayerAdd(key, player)
  this.colyseusRoom.state.players.onChange = (player, key) => this.handlePlayerChange(key, player)
  this.colyseusRoom.state.players.onRemove = (player, key) => this.handlePlayerRemove(key)
  
})

Context

I am creating a top-down shooter in 2d and had it working fine with Colyseus 9.x (working demo https://tdbr-cf83c.firebaseapp.com/).

I tried migrating on 10.x, but I get errors whenever a client reloads a tab when other clients are connected too.

Your Environment

  • Colyseus Version: server 0.10.1, client (JS) 0.10.2
  • Node.js Version: 10.15-alpine
  • Operating System and version: Ubuntu 18.04 LTS

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
halftheoppositecommented, Mar 28, 2019

Hi @endel, and thanks for the quick fix! It works perfectly now 👍

I’ll do my best to test as much as I can on the 0.10.x versions and let you know if I find anything weird indeed.

Thanks again for the great work 👏

1reaction
halftheoppositecommented, Mar 27, 2019

Just updated your rights to Developer, it should be good now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in template helper: TypeError: Cannot read property ...
It will determine what kind of data to populate based on collection schema. Share.
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... Bug:137286 - "app-emulation/dosemu: COPYING gets compressed by ecompress and can't be read" status:RESOLVED resolution:OBSOLETE severity:normal ...
Read more >
ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE ! ... Your browser can't play this video. ... Solved: ERROR TypeError : Cannot read property title of...
Read more >
Cannot read properties of undefined' - JavaScript Debugging
How To Fix ' Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging.
Read more >
Changelog - Cypress Documentation
Cypress no longer throws the error "cannot read property split of undefined" in certain circumstances when application errors are thrown. Fixes #17378.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found