Colyseus: [0.14.0] Problem with React-Native

Created on 21 Oct 2020  路  6Comments  路  Source: colyseus/colyseus

The new version 0.14.0 works great on web, but when I tried to upgrade my react-native app it failed. I downgraded my server and app back to 0.13.2 and it was working again.

this is the error log:

TypeError: _1.registerType is not a function. (In '_1.registerType("array", {
    constructor: ArraySchema,
    getProxy: getArrayProxy
  })', '_1.registerType' is undefined)
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
* /Users/bjoern/projects/arithmeticgame/node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
* /Users/bjoern/projects/arithmeticgame/node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
* /Users/bjoern/projects/arithmeticgame/node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
* /Users/bjoern/projects/arithmeticgame/node_modules/regenerator-runtime/runtime.js:293:29 in invoke
* /Users/bjoern/projects/arithmeticgame/node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
* /Users/bjoern/projects/arithmeticgame/node_modules/regenerator-runtime/runtime.js:154:27 in invoke
* /Users/bjoern/projects/arithmeticgame/node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
* /Users/bjoern/projects/arithmeticgame/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in invokeCallbackAndReturnFlushedQueue
need reproduction scenario

Most helpful comment

Hello @BjoernRave I would recommend first to set up a clean project and try to get it reproduced there. From what I can see there is something wrong with schema bindings. Also try to remove node_modules and package.lock and npm i again. I use RN 63.3 + colyseus haxe and it is working fine (except wss ping-pong handling on RN side)

All 6 comments

Hi @BjoernRave, I've just tried and failed to reproduce this, could it be that your package.json is specifying a previous version of @colyseus/schema? You should be fine to remove @colyseus/schema as a dependency from your project since colyseus already depends on the correct version needed

I don't have @colyseus/schema specified as dependency

Hello @BjoernRave I would recommend first to set up a clean project and try to get it reproduced there. From what I can see there is something wrong with schema bindings. Also try to remove node_modules and package.lock and npm i again. I use RN 63.3 + colyseus haxe and it is working fine (except wss ping-pong handling on RN side)

okay, so I really tried to make it work, but failed so I stripped out everything from my app, but colyseus and the error persists.

This is the repro: https://github.com/BjoernRave/colyseus14-RN-repro

Just run yarn and yarn start

Hi @BjoernRave, I've managed to reproduce it with your repository, thanks for providing it!

It seems @colyseus/schema had a circular dependency issue and it has been fixed now on @colyseus/[email protected] - removing your yarn.lock and installing the dependencies again should get rid of the issue!

(It's strange that I did not experience this error outside of React Native 馃槰 )

Let me know if that works for you! Cheers!

Yes, now it works.

Thank you very much for responding so quick. Appreciate your work on this project. It has been a pleasure working with it so far :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karneaud picture karneaud  路  4Comments

darkyen picture darkyen  路  6Comments

MarcusCemes picture MarcusCemes  路  3Comments

endel picture endel  路  5Comments

DenisNP picture DenisNP  路  5Comments