"Uncaught TypeError: Cannot read property '_schema' of undefined" when reloading tab with 0.10.2
See original GitHub issueIssue Description
Steps to Reproduce (for bugs)
- Connect a client on Chrome
- 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)
- Reload one of the tab (either Chrome or Firefox)
- 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:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 👏
Just updated your rights to
Developer
, it should be good now!