SamsungInternet / support

For general Samsung Internet support. You can use the Issues register here as a way to ask support questions.
MIT License
18 stars 0 forks source link

document.getElementsByClassName.ToString is not a function #56

Closed symi closed 5 years ago

symi commented 6 years ago

Hi,

We've been experiencing a large number of browser errors on our site coming from what looks like the new version of Samsung Internet starting around June 15th.

Example reproduction steps are to go to: https://www.onthebeach.co.uk/about-us and the error should happen on page load.

The error message is: document.getElementsByClassName.ToString is not a function.

I'm afraid the only stacktrace we have is in function (a,b,d,k,l).

The error is coming from browsers with the user agent string similar to: Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G935F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36 (Which I believe is the new version of Samsung Browser?)

It also looks like its happening on a wide range of Samsung devices, SM-G935F, SM-G950F, SM-A520F etc and Android versions 5, 6, 7 and 8.

I believe this isn't an error with our site and that its coming from the browser.

Let me know if you need any more information

poshaughnessy commented 6 years ago

Hi @symi. Thanks for reporting this.

A couple of questions please...

I just checked the site myself in v7.2 stable (v7.2.10.33 on a Pixel 2) and I couldn't see any errors with remote debugging:

screenshot from 2018-06-18 10-32-33

Are you still seeing the errors there?

Also, I wonder if there is a reason you are using ToString with a capital T, as opposed to toString with lowercase t?

I made this quick test and ToString is undefined in other browsers too...

Thanks, Peter

symi commented 6 years ago

Hi thanks for the reply!

Strange our error loggers caught another occurrence of the ToString error on that page this morning from a Pixel 2 at 9.18 UTC, which I believe was yourself.

Yeah, I assume the fact that somewhere the code is calling toString with a capital T as you say, but theres nothing in our application code which is calling ToString, nor has anything changed since last Friday in our application code.

It might be one of the 3rd party scripts we load has updated, but it seems strange that the errors are solely coming from Samsung Internet v7.2 browsers.

I've managed to recreate the error so it appears in our 3rd party error loggers but I will try what you've done and remote debug my session, just having issues getting my Macbook to see my Pixel 1 and vice versa atm 😩 Si

symi commented 6 years ago

Hi Peter,

Here are my remote debugging findings... At first I was seeing what you had, no error, but an error coming through in the logs still. I then turned on 'break on all exceptions' (including caught exceptions) and after clicking through a few errors, came to the error as shown below.

image (Pixel 1, running 7.2.10.33 on android 8.1.0)

Repeating the same steps on a browser such as Chrome 67 does not throw the exception.

I can't work out what is calling that piece of code however, search for it in all our application code and all the scripts that were loaded on the site at the time the exception occurred and nothing came up 🤔I assume you haven't heard of any other sites reporting a similar issue?

Si

poshaughnessy commented 6 years ago

Ah OK, that seems strange! I have asked our colleagues to take a look...

h3llc0r3 commented 6 years ago

Hi guys,

I've been investigating this bug for a couple days know as we see the exact same error since June 12th. As @symi already mentioned various Android versions but all devices are running SamsungInternet 7.2

samsung_internet

tostring

Some pages were we see this behaviour:

Investigation is highly appreciated @poshaughnessy

Tom

fwebdev commented 6 years ago

Hi,

we see the same strage behaviour on our Sites coming from SamsungBrowser/7.2. For example: (and on all other european TLDs for our Pages) https://www.parship.de https://www.elitepartner.de

Thanks for invensting Florian

micc83 commented 6 years ago

Same here.

browserName Samsung Internet browserVersion 7.2.0 userAgent: Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G930F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

schermata 2018-06-25 alle 09 16 58

Data33 commented 6 years ago

We're also getting a lot of these errors in our logs. The first occurences seem to have been June 14, not sure if that helps. The error has been logged ~4500 times in our application with the following browser share:

99.83% | Samsung Internet 7.2 0.17% | Samsung Internet 7.0

Hope this is of any help :)

johndaskovsky commented 6 years ago

We've had 2200 instances of this error since June 14th on Samsung Internet 7.2

TerryOShea commented 6 years ago

On Samsung Internet v7.2.0:

screen shot 2018-06-25 at 10 05 37 am

academo commented 6 years ago

We are seeing the same issue in the logs, more than 200.000 instances on this error only in the last 24 hours and we see a huge increment on it since the official release of Samsung Internet 7.2, they come from Android 7 and 8

Levivb commented 6 years ago

Same for us. Seeing this error across all our sites.

First error since last 30 days for this report starts at june 8, 2018: screen shot 2018-06-26 at 19 10 43

Website is werkenbijdefensie.nl. Which, if it matters, uses jquery 1.10.2. Other sites also reporting this error are using jquery 1.11.3

poshaughnessy commented 6 years ago

Thanks everyone for sharing your information about this. Our colleagues are investigating this and it looks like the cause has now been identified. We look forward to sharing further details as soon as we can.

ValentinFlorea commented 6 years ago

We got since June 15th 265.000 errors captured by Sentry on vakantieveilingen.nl. Initially the error count each day was very low but recently it has been increasing a lot. Also spent > 1 week trying to figure if this is part of any tracking script, A/B test, potentially inline JS added in the CMS, etc.

Had to disable the NewRelic JS alerting due to the unmanageable levels of errors.

So even if this is not having a serious impact on the well-being of the users, it forces us to disable other types of monitoring which would alert us if we have a serious bug. So please fix it and implement changes that would prevent such bugs from appearing in the future in stable versions of your browser.

esseb commented 6 years ago

@ValentinFlorea you can tell Sentry not to report this error, see https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry

Add 'document.getElementsByClassName.ToString' to the ignoreErrors list.

ValentinFlorea commented 6 years ago

:) thank you. We did that already. Harder to do that with NewRelic though. But doesn't matter, it's good the guys are looking into this.

dalibormesaric commented 6 years ago

Thanks @poshaughnessy ! Could you also please share some more details on where is this code coming from?

rubenisgurkitis commented 6 years ago

We have the same issue in lieferheld.de, around 30k hits during the last month in NR. Is there any update @poshaughnessy?

peteychuk commented 6 years ago

The same issue from our side.

limonte commented 6 years ago

Same here, hundreds of reports.

jgestevez commented 6 years ago

Same issue, only happening for Samsung Devices

bruce4dev commented 6 years ago

We also met this error, please help follow up and update this status. Thanks. Most come from SamsungBrowser/7.2, less from SamsungBrowser/7.0 Android 7.0, 8.0, 6.0

robsco commented 6 years ago

Thank god other people started to see this too. I've been Googling for days and not finding anything until today (this page).

Uncaught TypeError: document.getElementsByClassName.ToString is not a function

Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G955F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

kud commented 6 years ago

I don't know if it's related (however it seems to be) but Sentry tells me I've got this error too document.getElementsByClassName.ToString is not a function. I don't have any ToString in my own code.

It comes from this userAgent:

Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-A320FL Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

Website: https://www.contexte.com

Knud13 commented 6 years ago

Getting the same error from userAgents; the string '537.36' is common

Mozilla/5.0 (Linux; Android 6.0.1; SAMSUNG SM-G903F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36 Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G920F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36 Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G935F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

poshaughnessy commented 6 years ago

Hi all. Our colleagues have let us know that these errors are coming from code to do with our Reader Mode. I have good news and bad news...

The good news is that this should already be fixed in our v7.4 Beta which is available now for testing.

The bad news is that unfortunately it is going to take a while for v7.4 to be released on our stable channel and get everyone updated. We would love to be able to make a quick hotfix, but any stable release for us has to go through an approval process involving mobile carriers and this typically takes a few weeks.

We recognise this is a bad situation to leave you all in, in the meantime, getting all these errors. We apologise and hope that you can find appropriate ways in your monitoring systems to hide these errors for now.

We'll discuss what we can do to further prevent such problems arising in the future. Please also continue to test our beta versions and let us know any feedback you have. Thank you.

Lenn-dewit commented 6 years ago

We're having the same problem as well on nle.nl/klantenservice only. Seems odd since I would imagine getting it on other pages as well. Oh well.

Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G950F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

Thanks alot for investigating and fixing this problem!

hoektoe commented 6 years ago

90k events and growing fast.

Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G920F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36

Thanks for the feedback and addressing the issue

nuxodin commented 6 years ago

Same here
Uncaught TypeError: document.getElementsByClassName.ToString is not a function

Always line:1 column:33

xosofox commented 6 years ago

Let's assume we can stop reporting this error as Samsung acknowledged they fmessed up and confirmed the bug.

The interesting part for me now is:

a) does this affect every page load? If so, how could this slip through the "approval process" that 7.4 has to go through now? b) if this is not happening on every page, what is the "obviously uncommon edge case" that everybody created who is assembled here?

@poshaughnessy any hints on a) or b)

Akash91 commented 6 years ago

Just integrated sentry yesterday in one of our major consumer product, getting more than 1k error per day. For now I have just marked these error in ignore, also I tried reproducing with browserstack but wasn't able to reproduce

kud commented 6 years ago

Please, stop reporting this error as the authors are aware of this and are working on it.

https://github.com/SamsungInternet/support/issues/56#issuecomment-402423676

Ignore it on your monitor system.

deepakgurung commented 6 years ago

Apart from updating the browser or ignoring it in our tracking system... Is their any option to handle it in our code....

kud commented 6 years ago

Add this to your code:

Object.prototype.ToString = function() {
   console.log('Oh no, not you again, SamsungInternet')
} 
deepakgurung commented 6 years ago

Where do I need to add this in my code? Adding this in my js file is giving lots of error....

poshaughnessy commented 6 years ago

Thanks again everyone for your patience. Just to clarify in the meantime:

We'll update here again when v7.4 is released to stable.

pcpalle commented 6 years ago

Object.prototype.ToString = function () { return this.toString(); }

yasirahmedsiddiqui commented 6 years ago

Same issue, only happening for Samsung Devices

Sly777 commented 6 years ago

@pcpalle solution doesn't work if you are using react.

EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `ToString`.
computamike commented 6 years ago

Is there some link between Samsung browser and Chrome? I'm getting similar ToString errors, but the browser is reporting as Chrome. Looking at the detail the user agent actually reports as :

Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G965F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.2 Chrome/59.0.3071.125 Mobile Safari/537.36
sungjaeHong commented 6 years ago

@kud Thx! it's work 👍 ---------edit--------- sorry it's not work. It cause 'Uncaught TypeError: V[g].exec is not a function'

mshildkret-handy commented 6 years ago

@pcpalle tried that and it broke lots of other js on my site, no idea why. digging into it....

mshildkret-handy commented 6 years ago

that somehow caused an error in RegExp class where the function exec() was not defined anymore...

sungjaeHong commented 6 years ago

@mshildkret-handy same problem.... It make 'Uncaught TypeError: V[g].exec is not a function'

mshildkret-handy commented 6 years ago

yeah i dug into the debugger, and v[g] (just minified var names, mine were different) is returning a function rather than RegExp. g is "ToString" and V is some sort of strange object. Regardless, this breaks a lot of JS code, so please do not use it. you can define ToString on Function.prototype instead.

skarankevich commented 6 years ago

I have the same error: document.getElementsByClassName.ToString is not a function

Is it a typo in toString method?

Device:

synweap15 commented 6 years ago

Function.prototype.ToString = function () { return this.toString(); } is the correct answer for the time being, @pcpalle's solution causes issues mentioned by @sungjaeHong.

sungjaeHong commented 6 years ago

@synweap15 that is working? I try that too. but still error V[g].exec.

hmm..... I will try again tomorrow.

mshildkret-handy commented 6 years ago

@synweap15 yes thats what i did and it worked fine for me. @sungjaeHong those types of errors stopped for me. I also wrapped it with: if (!Function.ToString) { ... } but I dont think that should make much of a difference.

sungjaeHong commented 6 years ago

@mshildkret-handy Oh... sorry I had typo ;D I was used Object.prototype.ToString but I fix to Function.prototype.ToString It is work! Thanks