# WebXR properties of undefined error on enter

**URL:** <https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777>\
**Category:** Bugs\
**Tags:** webxr\
**Created:** [August 4, 2022, 1:24pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777 "2022-08-04T13:24:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrancoBolevin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/francobolevin/32/26067_2.png) [@FrancoBolevin](https://forum.babylonjs.com/u/FrancoBolevin)\
**Post date:** [August 4, 2022, 1:24pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/1 "2022-08-04T13:24:01Z")

</div>

Hi there,

We recently started having problems with the web XR. Getting the following error when trying to enter XR:

`TypeError: Cannot read properties of undefined (reading 'attachedToElement')`

I can’t seem to reproduce this error in the playground, but it is consistently happening in our code. We are on version 5.15 of Babylon, I also tried this on the latest version (5.18) with the same result. Setting the Babylon version back to an older version, like 4.20, seems to resolve this specific issue.

We are using the functionality like this:

```auto
const xr = await this.scene.createDefaultXRExperienceAsync({floorMeshes: [this.scene.getMeshByName('zero-height-floor')]});
const session = await xr.baseExperience.enterXRAsync("immersive-vr", "local-floor")

```

Any advice would be greatly appreciated!

Kind regards,  
Franco

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 9, 2022, 4:33pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/2 "2022-08-09T16:33:28Z")

</div>

Assigned @RaananW on August 9, 2022, 4:33pm UTC



---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 9, 2022, 4:36pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/3 "2022-08-09T16:36:54Z")

</div>

Unfortunately @RaananW is in vacation at the moment until the end of this week so you might experience a bit of delays for the answer.

In the meantime, a repro would really help as I cannot see where this could happen in the code ☹

---

<div class="post-metadata">

**Author:** ![FrancoBolevin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/francobolevin/32/26067_2.png) [@FrancoBolevin](https://forum.babylonjs.com/u/FrancoBolevin)\
**Post date:** [August 11, 2022, 8:40am UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/4 "2022-08-11T08:40:52Z")

</div>

Hi @sebavan thanks for having a look.

We are still a bit stuck there, I will keep trying to reproduce this as well.

Appreciate the time 👍

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 11, 2022, 2:15pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/5 "2022-08-11T14:15:52Z")

</div>

> [@FrancoBolevin](#):
>
> attachedToElement

Ohhh I may have found it, will push a fix in a sec 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 11, 2022, 2:18pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/6 "2022-08-11T14:18:32Z")

</div>

> <https://github.com/BabylonJS/Babylon.js/pull/12859>
>
> https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 11, 2022, 2:18pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/7 "2022-08-11T14:18:44Z")

</div>

Unassigned @RaananW on August 11, 2022, 2:18pm UTC



---

<div class="post-metadata">

**Author:** ![FrancoBolevin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/francobolevin/32/26067_2.png) [@FrancoBolevin](https://forum.babylonjs.com/u/FrancoBolevin)\
**Post date:** [August 11, 2022, 2:40pm UTC](https://forum.babylonjs.com/t/webxr-properties-of-undefined-error-on-enter/32777/8 "2022-08-11T14:40:31Z")

</div>

Awesome thank you!
