How to use HTMLMesh to display a DOM element in AR view?

I am trying to display a DOM element in 3D space in AR view using HTMLMesh from ThreeJS. Every time I try to add the element to the scene, it does not display and also I get this warning in the console:

WebGL: INVALID_VALUE: texImage2D: no canvas

This is my code:

 let html = [
            '<div style="width:100px; height:100px; background-color: red">',
            '<h2>Some info in a panel</h2>',

    let div = document.createElement("div");

    div.innerHTML = html;

    let object = new THREE.HTMLMesh(div);
    object.position.set(position.x - 2, position.y + 2, position.z - 4);