DOMException with createDefaultXRExperienceAsync

sorry to bother but:
open Babylon.js Playground and the devtools:

Uncaught (in promise) DOMException: An attempt was made to use an object that is not, or is no longer, usable.

happens only with babylon > v7

3 Likes

I had the same issue a few times before. I couldn’t find the reason, but restarting the browser usually is enough to fix it

Is it reproducible just by opening the playground? or do I need to try entering XR? Can you share a bit of info about your environment? what browser/system? Go the WebXR emulator installed? any XR flags turned on?

Oh! and could you share a stacktrace, if possible?

you have to try entering xr, but it really did not always happen so quite hard to reproduce :confused: (I can’t reproduce it anymore) I was using chrome on windows, but with a custom OpenXR runtime so I thought that was the issue at the time.

1 Like

Thanks for the quick reply.

Just open the PG without VR device attached
on windows 10 with all chrome based browsers: chrome, canary, edge , brave
no flags no emulator. restart browser does not help.
Other Errors with firefox:

  • Error initializing XR [babylon.js:1:188864]
  • WebXR not available

The scenes are running fine, so not that big issue but worrying.
I use/test my scenes also in desktop mode
No error in console on quest with devtools via USB
It looks like some check for XR device is gone

On debug i end up arround:

    _makeCanvasCompatibleAsync() {
        this._canvasCompatiblePromise = new Promise((resolve) => {
            if (this.canvasContext && this.canvasContext.makeXRCompatible) {
                this.canvasContext.makeXRCompatible().then(() => {
                    resolve();
                });
            }
            else {
                resolve();
            }
        });
    }

resolves are never hit.
I can debug further but hope it is easy for somebody who knows the internals .

This is a cought exception when trying to initialize WebXR in environments that don’t have WebXR. The scene will continue to render, as you say, mainly because the exception is caught (but logged). But this is not the error you pasted initially, right? or is it related?

The DOMException is the Error i get if no XR device is attached


So that means you do not get this Error on your device/system ?

2 Likes

It’s interesting. I don’t, though I don’t have XR enabled (it’s a mac). But i’ll check and see if I can avoid showing all of those errors when XR is not available

I just updated an older babylon project (babylon 5) to the latest (7.9) and am now getting this error. Though other things may be broken as well.

I have another project that is 7.9 that does not get this error though.

1 Like

Is this related to the question, or is this a new topic?

? Its the exact same error.

Triggered from: “this._xrHelper = await this._scene.createDefaultXRExperienceAsync({”

I’m on PC and currently do not have a VR headset plugged in.

I will have to try reproducing this. I assume it doesn’t influence rendering? or does it throw and stop the render loop?

If anyone else is experiencing this issue - please share your browser version and os. I am trying to figure out where this is coming from, becasue I can’t reproduce this. This is a related issue - makeXRCompatible() doesn't work on (Windows) Chrome 88 · Issue #266 · MozillaReality/WebXR-emulator-extension · GitHub , but it should have been resolved a long time ago.

I am using Chrome 126 on Windows 10 when not having any XR device connected (I still have to test when I plug a device)

1 Like

I don’t have the issue when I plug a headset in the computer :thinking:

Do you happen to have two GPUs? dedicated and intel one? Just wondering.

I only have an Nvidia A4000. The weird thing is that I tried on another computer also with Win10 and an A4000 and I got no error :man_facepalming:

I think quantum fluctuations are the culprit for this bug :joy:

I pushed a change yesterday that should catch this error and ignore it when not needed. Next version will be released in the next few days, would be very interesting to know if you still get it. Playground should already have the new version

I will try again when the new version releases then :wink:

1 Like

I have the following error now: