_checkForConnectedDevices throw "TypeError: Illegal invocation"

We see quite often this error on new Scene in our tracking tool, but we can not reproduce it.

TypeError: Illegal invocation
  at _checkForConnectedDevices(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/DeviceInput/InputDevices/webDeviceInputSystem.js:177:38)
  at _enableEvents(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/DeviceInput/InputDevices/webDeviceInputSystem.js:143:18)
  at new e(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/DeviceInput/InputDevices/webDeviceInputSystem.js:36:14)
  at new e(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/DeviceInput/InputDevices/internalDeviceSourceManager.js:50:39)
  at new e(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSourceManager.js:15:49)
  at attachControl(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/Inputs/scene.inputManager.js:435:37)
  at attachControl(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/scene.js:1522:28)
  at new t(webpack://egr-onlineplanner/./node_modules/@babylonjs/core/scene.js:665:19)
  • Browser is always Chrome (different versions 79, 80, 96, 97, 98)
  • OS always Windows 10
  • atm we use babylonjs/core 5.0.0-beta.9 but we saw the error already in our previous builds with 5.0.0-alpha.45
  • because i don’t see any changes to the _checkForConnectedDevices callback in babylonjs/core latest version i guess the error will continue to occure when we update

cc @PolygonalSun

@daniel-rabe can you repro in the playground ? I am wondering if it is related to one functionality in use in your code, or if it is more related to some environments. Would be awesome if you have a repro :slight_smile:

unfortunately we cannot reproduce it.

var gamepads = navigator.getGamepads();
seems to throw the error on creating the scene

It occurs on different platforms windows/mac/ios
It seems to be always chrome browser, but affects only a really small part of our sessions.

In the web you find some threads about navigator occasionally looses its context.
You May Not Know Beacon the article is about referencing navigator functions.
but maybe it is the same issue here.

In firefox we really rarely get:
Navigator.getGamepads: Document’s Permission Policy does not allow calling getGamepads() from this context.

Our production version is currently 5.15.1

Unfortunately there is not much we can do from the babylon side on this one :frowning:

I wonder how hard it would be for you to get more data to share with the Chromium team as it sounds like a bug on their side ?