# Glimmer-site-header.gjs:144 getBoundingClientRect error only when custom plugin enabled

**URL:** https://meta.discourse.org/t/glimmer-site-header-gjs-144-getboundingclientrect-error-only-when-custom-plugin-enabled/390874
**Category:** Development
**Created:** [December 10, 2025, 8:04am UTC](https://meta.discourse.org/t/glimmer-site-header-gjs-144-getboundingclientrect-error-only-when-custom-plugin-enabled/390874 "2025-12-10T08:04:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Steve\_John](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steve_john/32/435022_2.png) [@Steve\_John](https://meta.discourse.org/u/Steve_John)
#### Post date: [December 10, 2025, 8:04am UTC](https://meta.discourse.org/t/glimmer-site-header-gjs-144-getboundingclientrect-error-only-when-custom-plugin-enabled/390874/1 "2025-12-10T08:04:53Z")

</div>

Hi,

On a recent Discourse (Ember 6.6.0), I’m getting this error in the browser console, but only when my custom plugin is enabled:

```plaintext
glimmer-site-header.gjs:144 Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
    at recalculateHeaderOffset (glimmer-site-header.gjs:144)
    at setupHeader (glimmer-site-header.gjs:212)
    ...

```

What I’ve done so far:

• With all custom plugins disabled → no error.  
• With only my plugin enabled (on the default theme) → error appears.  
• Searched the plugin for d-header, site-header, glimmer-site-header, getBoundingClientRect:  
◦ The plugin never touches the header; it only adds components via connectors:  
▪ discovery-list-area/…  
▪ below-site-header/…  
▪ below-main-outlet/…  
• Tried defensively creating a stub .d-header element in the plugin initializer if none exists, but the error still occurs.  
• On pages where the error fires, document.querySelector(‘.d-header’) returns an element.

Questions:

1. Under what conditions can glimmer-site-header end up calling element.getBoundingClientRect() on null?
2. Is there anything special about using the below-site-header connector or adding body classes that could interfere with the new header component?
3. Is there a recommended way for plugins to safely coexist with glimmer-site-header so this null access can’t happen?

Any pointers or known issues around this would be very helpful.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 10, 2025, 12:50pm UTC](https://meta.discourse.org/t/glimmer-site-header-gjs-144-getboundingclientrect-error-only-when-custom-plugin-enabled/390874/2 "2025-12-10T12:50:57Z")

</div>

I don’t know if this is your problem, but rather than connectors, you should now use `api.renderInOutlet`. I find that more intuitive and less fiddly.

> <https://github.com/literatecomputing/discourse-custom-components/blob/main/javascripts%2Fdiscourse%2Fapi-initializers%2Fcustom-components.gjs>
