28

I'm currently receiving a weird JavaScript error on my error monitoring tool Sentry that says can't redefine non-configurable property "userAgent".

It seems like the error is happening on multiple pages but only on Firefox. Additionally, on all errors the referrer page seems to be "https://www.startpage.com/".

However, I'm not able to reproduce the error and have no clue whats causing the error as I do not have any assignments to the navigator.userAgent var.

Does anyone else have this issue, too, or has any clue what could cause this error?

11
  • 1
    This one is pretty cryptic. I have it on my app too and its taken me a while to figure out what is going on. Do you happen to be doing any browser detection ? even if you dont have assignments to the navigator.userAgent, are you trying to sniff the browser with it? Commented Feb 4, 2021 at 0:52
  • Yes, I actually do have a check on the user agent like this navigator.userAgent === 'native'. I`m setting the user agent within my native app's webview to 'native' to be able to detect whether my website is visited within a normal browser or within a webview of my app. But the errors do not occur while using my native app, just via the Firefox browser. Do you think the check could still cause the issue? Commented Feb 4, 2021 at 6:58
  • 11
    It could be possible that a firefox extension/setting is messing with the user Agent. This article is very useful to explain that we should not be using the userAgent to determine browsers, even mobile. developer.mozilla.org/en-US/docs/Web/HTTP/… So for me, my guess is that the user has a setting or an extension in firefox that allows them to overwrite their userAgent and perhaps this gets logged into the console because we are using userAgent to derive browser info. Commented Feb 4, 2021 at 18:55
  • @EstherCuan Very interesting! Thank you for the information! :) Commented Feb 5, 2021 at 8:56
  • 4
    I got reports of this error in Sentry two time the past months. Firefox 86 and 85, but no clue what the cause is. Very little information provided in the Sentry event. No tickets have been created for this event. I don't use userAgent in the application code, it's used by dependencies so my first step will be to upgrade them. And I'll try to get more information in Sentry. And then we wait 🍺 Commented Mar 16, 2021 at 8:58

1 Answer 1

1

I have seen this exact message before when trying to call Object.defineProperty on a property that is 'non-configureable' in strict mode. You have something in your code or in one of your deps that is trying to redefine a property using this method.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_delete

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.