Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript error on Firefox: TypeError: can't redefine non-configurable property "userAgent"

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?

like image 804
Ferdinand Frank Avatar asked Feb 03 '21 18:02

Ferdinand Frank


People also ask

What is navigator userAgent in Javascript?

The Navigator userAgent property is used for returning the user-agent header's value sent to the server by the browser. It returns a string representing values such as the name, version, and platform of the browser.

How do I find my browser user-agent?

The user-agent string of the browser is accessed using the navigator. userAgent property and then stored in a variable. The presence of the strings of a browser in this user-agent string is detected one by one. Detecting the Chrome browser: The user-agent of the Chrome browser is “Chrome”.


1 Answers

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

like image 143
Goodword Avatar answered Sep 24 '22 21:09

Goodword