posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Cannot convert undefined or null to object

Open MathiasWP opened this issue 1 year ago • 2 comments

We got this error in Sentry:

image

Here's the minified code that seems to crash:

function _e(e, t) {
		let n,
			r,
			o,
			a = e.mirror,
			i = e.stylesheetManager,
			s = null;
		s = '#document' === t.nodeName ? a.getId(t) : a.getId(t.host);
		const c =
				'#document' === t.nodeName
					? null === (n = t.defaultView) || void 0 === n
						? void 0
						: n.Document
					: null ===
								(o = null === (r = t.ownerDocument) || void 0 === r ? void 0 : r.defaultView) ||
						  void 0 === o
						? void 0
						: o.ShadowRoot,
			u = Object.getOwnPropertyDescriptor(null == c ? void 0 : c.prototype, 'adoptedStyleSheets'); // <--- `getOwnPropertyDescriptor` is line 1:43134
		return null !== s && -1 !== s && c && u
			? (Object.defineProperty(t, 'adoptedStyleSheets', {
					configurable: u.configurable,
					enumerable: u.enumerable,
					get: function () {
						let e;
						return null === (e = u.get) || void 0 === e ? void 0 : e.call(this);
					},
					set: function (e) {
						let t,
							n = null === (t = u.set) || void 0 === t ? void 0 : t.call(this, e);
						if (null !== s && -1 !== s)
							try {
								i.adoptStyleSheets(e, s);
							} catch (e) {}
						return n;
					}
				}),
				Le(function () {
					Object.defineProperty(t, 'adoptedStyleSheets', {
						configurable: u.configurable,
						enumerable: u.enumerable,
						get: u.get,
						set: u.set
					});
				}))
			: function () {};
	}

MathiasWP avatar Mar 20 '24 11:03 MathiasWP

Hey Mathias...

Can you open this as a support ticket in app as we'll need to ask details about your site specifically which you might not want to share publicly? :)

We'll need a link to the session or sessions and whether the page is public for us to visit and investigate?

Does the sentry issue suggest it's a particular browser that's having the issue?

https://us.posthog.com/#panel=support%3Asupport%3Asession_replay%3Alow

Thanks!

pauldambra avatar Mar 20 '24 12:03 pauldambra

Hey Mathias...

Can you open this as a support ticket in app as we'll need to ask details about your site specifically which you might not want to share publicly? :)

We'll need a link to the session or sessions and whether the page is public for us to visit and investigate?

Does the sentry issue suggest it's a particular browser that's having the issue?

us.posthog.com/#panel=support%3Asupport%3Asession_replay%3Alow

Thanks!

I opened a support ticket.

More info:

  • Browser: Chrome 122.0.0
  • OS: Windows >= 10
  • Runtime: Browser

MathiasWP avatar Mar 20 '24 13:03 MathiasWP

closing this since a support ticket was opened

pauldambra avatar Jul 11 '24 21:07 pauldambra