Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError null is not an object (evaluating 'elt.parentNode') #756

Closed
adamreisnz opened this issue Oct 29, 2016 · 44 comments
Closed

TypeError null is not an object (evaluating 'elt.parentNode') #756

adamreisnz opened this issue Oct 29, 2016 · 44 comments

Comments

@adamreisnz
Copy link

I have started getting some error reports in Sentry from our JS app which look like this:

TypeError null is not an object (evaluating 'elt.parentNode')

Problem is, that nowhere in our own source code, nor in our vendor source code, can I find a single instance of elt.parentNode in the code.

Also, Sentry seems to have a hard time reporting the source of the error as well:

TypeError: null is not an object (evaluating 'elt.parentNode')
  at ? (/shop/kleding/new-arrivals/fresh/donkerblauw:1:350)

This doesn't actually point to any JS code, just the rendered HTML of our SPA.
And in the breadcrumbs, it just gets repeated several times:

image

In short, I have no idea where this error is coming from, and I am suspecting it might be generated by Sentry itself somehow, as I can't find any references to it in our own code.

Any suggestions on how to analyse this further and/or rule out Sentry/ravenjs as the source of this issue?

@benvinegar
Copy link
Contributor

benvinegar commented Oct 31, 2016

I am suspecting it might be generated by Sentry itself somehow, as I can't find any references to it in our own code
...
Any suggestions on how to analyse this further and/or rule out Sentry/ravenjs as the source of this issue?

Well, if "ruling out" means "can't find any references to it" in code, elt.parentNode isn't found in the Sentry source either.

It might be caused by a 3rd-party browser extension or browser malware.

@adamreisnz
Copy link
Author

@benvinegar Ok, I will assume it's from a browser extension then, thanks.

Is there a way to somehow avoid browser extensions from triggering sentry errors?

@dugwood
Copy link

dugwood commented Nov 4, 2016

Sorry to bother you, but I'm seeing the exact same issues since I've installed Prebid.js on my website. I caught errors in a dedicated script, but I can't figure out what is causing this. Do you have more info in your Sentry's log?
The error only occurs on iOS devices, AFAIK. Including iPhones, so the 3rd-party extension doesn't seems to be the issue here.

@suavelizard
Copy link

I got the same issue also on iOS/Safari with an Angular application. No way to track this down.

@dugwood
Copy link

dugwood commented Nov 4, 2016

@suavelizard do you manage to see it in your console? If so, can you point us to a demo of your application? I'll narrow it down :-)

@suavelizard
Copy link

suavelizard commented Nov 4, 2016

No I'm also only getting it through Sentry

TypeError: null is not an object (evaluating 'elt.parentNode')
  at ? (/cart:1:351)
  at global code(/cart:1:1238)

I think it may be something to do with an input field.

@dugwood
Copy link

dugwood commented Nov 4, 2016

Same thing in my debug code, line 1, column is random, on the main url. Seems like an inline code... And a real bug in iOS, for a specific Javascript code.

@suavelizard
Copy link

Breadcrumbs:

  • ui.click
    footer.page-footer.ng-scope > div.email-capture.row.ng-scope
    TypeError: null is not an object (evaluating 'elt.parentNode')
  • ui.click
    div.email-capture.row.ng-scope > div#email-section > p
    exception
    TypeError: null is not an object (evaluating 'elt.parentNode')

@CanRau
Copy link

CanRau commented Nov 9, 2016

i'm not using sentry but my own little window.onerror handler is sending me the same message, coming from an ipad running safari, as i've got only one js file I think I tracked it down to this helper function

    function remove(el) {
        if (!el.parentNode) return false;

        return el.parentNode.removeChild(el);
    }

line number and column number point to this function even though in the function it's el.parentNode and not elt.parentNode

so maybe this info might help someone to track this down

@dugwood
Copy link

dugwood commented Nov 9, 2016

@CanRau can you run a console.log(el) to see what you have in the el.parentNode?

Does this function exist in your own code or it's part of something else? Everyone here has the issue on elt, without an elt variable anywhere. But your issue may help understanding the issue we're facing.

@CanRau
Copy link

CanRau commented Nov 9, 2016

hmm the thing is I got this error by mail so I can't reproduce it myself right now and just placing console.log(el) in production might lead to other issues, besides it's not my console^^
so i would have to add the output to the error being sent..

maybe you got a hint?

@dugwood
Copy link

dugwood commented Nov 9, 2016

I'll try the same code on a Safari of one iPhone I have here... hoping it'll trigger the same behaviour! Thanks for the code!

@adamreisnz
Copy link
Author

adamreisnz commented Nov 9, 2016

I am suspecting there are 2 possible scenario's based on all the information we have:

  1. Safari (or a 3rd party extension/app on iPad) runs some mysterious internal browser code on the site which triggers the error, and when it fails it's picked up by Sentry. Because the code is in the browser and not in any of the actual vendor/app scripts, Sentry can't pinpoint the source of the error and as such the error report is pretty useless.

  2. Less likely, Safari renames variables in the scripts when running them and that's why we see elt.parentNode instead of something else. However, I think this is very unlikely, as it doesn't make sense and doesn't explain the fact that Sentry can't pinpoint the error source.

Since manipulation of the DOM parent node is such a common thing, it would be easy to find some reference in your own (or vendor) code that has el.parentNode or element.parentNode.

But I think the giveaway that something else is going on is the unusual elt prefix. I haven't been able to find that in my own code, nor in vendor code (Angular), so that's why I think it must be something weird external.

And in addition, the fact that quite a few people have found this issue since I created it, even people that don't use Sentry, leads me to believe it's quite a widespread problem, which makes it even more likely that it's something Safari or plugin specific.

@CanRau
Copy link

CanRau commented Nov 9, 2016

sounds valid..but my error message told me line and column which referenced the remove function above, could be coincidence though...
I thought safari is not actually renaming or rewriting the script but the error reference?!

@Yann577
Copy link

Yann577 commented Nov 10, 2016

I am also trying to find what causes this. We have some stats on our website that shows this started happening on October 25th, the day after Apple and Safari got updates:

https://support.apple.com/en-ca/HT201222

It also happens exclusively on Safari on IOS on our side, according to the requests User-Agent

@kerrpeter
Copy link

I get a similar error message occasionally on Safari on IOS devices and they first started on Oct 26th.
However I don't actually use Sentry, I use my own logging of any Javascript errors. So it sounds like this is coming form some update as Yann577 mentions, but I've no idea what.

@tobsn
Copy link

tobsn commented Nov 16, 2016

I found this post here by googling for the error... I'm not using raven but I have the same issue popping up starting at the same mentioned time. I'm using jquery, sisyphus, mixpanel, jquery.inputmask, jquery.blockUI, and bootstrap on the page and there is no elt.parentNode in ANY of those sources, I looked everywhere.

At the same time I'm also seeing these errors coming in right after each other only from iPhone/iPad:

TypeError: null is not an object (evaluating 'document.getElementById('top-ad').style')
TypeError: null is not an object (evaluating 'document.getElementById('mojivaiframediv').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_banner').style')
TypeError: null is not an object (evaluating 'document.getElementById('q-footer').style')
TypeError: null is not an object (evaluating 'document.getElementById('ads_top').style')
TypeError: null is not an object (evaluating 'document.getElementById('aframe0').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_adTop').style')
TypeError: null is not an object (evaluating 'document.getElementById('bannerad').style')
TypeError: null is not an object (evaluating 'document.getElementById('adSpace').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_topAd').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_banner').style')
TypeError: null is not an object (evaluating 'document.getElementById('bannerad').style')
TypeError: null is not an object (evaluating 'document.getElementById('ads_top').style')
TypeError: null is not an object (evaluating 'document.getElementById('aframe0').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_topAd').style')
TypeError: null is not an object (evaluating 'document.getElementById('mojivaiframediv').style')
TypeError: null is not an object (evaluating 'document.getElementById('q-footer').style')
TypeError: null is not an object (evaluating 'document.getElementById('adSpace').style')
TypeError: null is not an object (evaluating 'document.getElementById('wid_adTop').style')
TypeError: null is not an object (evaluating 'document.getElementById('top-ad').style')

My guess is that all those errors and the elt.parentNode is caused by some adblocker... along the errors above I now constantly see from Android devices:
Uncaught SyntaxError: Unexpected identifier

Not sure whats going on, those errors started popping up over the last 2 weeks from pages that had no errors thrown since they were put live.

@borg4242
Copy link

Chiming in as I see the same problem on prod sites + have some supplemental info + this thread is the #1 result on Google.

  • We only see this with Safari 600.1.4 (iOS 8?).
  • We managed to get the call stack but it's not very helpful: {/hereisourpageurl/:1:351 global code@/hereisourpageurl/:1:1238}.
  • Our HTML doesn't have JS in the first few lines so these numbers don't make sense in that context.
  • We're not using Santry and mostly using established JS libs like jQuery -- nothing bleeding edge. Our code doesn't have elt.parentNode anywhere, not in the libraries we use either.
  • We do use New Relic that is known to inject JS in the code and it does have e.parentNode, but it does not inject it to the first line and e.parentNode is around column 12000 so it's probably not the culprit.

I'd wager this is an iOS 8 Safari specific issue, for some code that's written in JS and injected into the HTML. Could be someone using iOS Safari behind some corporate firewall that injects JS that is not compatible with iOS8?

@tobsn
Copy link

tobsn commented Nov 18, 2016

See above, seeing this exclusively on iOS 10 latest public stable (iPhone/iPad).
Funny enough i tested with 5 devices and it didn't happen. FYI it's sometimes a web view sometimes not.

@lucke84
Copy link

lucke84 commented Nov 18, 2016

Some more data from yet another website's traffic (got it via the magical sentrycli by Opera):

+---------------------+--------+-----------+-------+------+
| browser             | device | os        | count |    % |
+---------------------+--------+-----------+-------+------+
| Mobile Safari 9.3.5 | iPad   | iOS 9.3.5 |   231 | 73.1 |
| Mobile Safari 8.1.3 | iPad   | iOS 8.1.3 |    21 |  6.6 |
| Mobile Safari 8.3   | iPad   | iOS 8.3   |    16 |  5.1 |
| Mobile Safari 8.1.2 | iPad   | iOS 8.1.2 |    15 |  4.7 |
| Mobile Safari 9.3.4 | iPad   | iOS 9.3.4 |    11 |  3.5 |
| Mobile Safari 9.3.3 | iPad   | iOS 9.3.3 |    10 |  3.2 |
| Mobile Safari 9.3.2 | iPad   | iOS 9.3.2 |     8 |  2.5 |
| Mobile Safari 9.3.5 | iPhone | iOS 9.3.5 |     2 |  0.6 |
| Mobile Safari 8.1.1 | iPad   | iOS 8.1.1 |     1 |  0.3 |
| Mobile Safari 8.1   | iPad   | iOS 8.1   |     1 |  0.3 |
+---------------------+--------+-----------+-------+------+
Total: 316

@bflora2
Copy link

bflora2 commented Nov 18, 2016

I have been receiving a lot of these same error reports as well (I do not use Sentry).

  • They started by at least Oct 28 (maybe a little earlier, some of my earlier reports have already been deleted)
  • The error is being received from iOS 8, 9, and 10
  • The error ONLY occurs on Safari 600.1.4
  • The error ONLY occurs for users agents that contain "GSA/20.3.136880903"
  • The error occurs well after my page has finished loading, but I don't know what triggers it
  • The error is occurring for less 1% of my iOS visitors, but IP addresses that report the error tend to report it again in later sessions

This leads me to believe Safari 600.1.4 introduced a change that broke someone's browser extension (GSA?). I plan to filter the error and ignore it.

@adamreisnz
Copy link
Author

Just had another occurrence of this error:

browser: Mobile Safari 10.0.2 (Safari/600.1.4)
device: iPhone
os: iOS 10.0.2

TypeError: null is not an object (evaluating 'elt.parentNode')
  at None (/:1:350)
  at global code (/:1:1237)

I guess we can be pretty sure now that it's an issue isolated to specific versions of Safari somehow.

@paknudsen
Copy link

Getting thousands of these errors.
@bflora2 seems to be spot on.

@umair1191
Copy link

umair1191 commented Nov 28, 2016

I am getting the same error for IPads
TypeError
null is not an object (evaluating 'elt.parentNode') I am using Sentry and in the details it shows:
Remote file took too long to load: (15s, https://www.*********.com/******_form.php?opt=MA==) Collapse { "url": "https://www.**********.com/*******_form.php?opt=MA==", "timeout": 15 }
screenshot

@wuservices
Copy link

I'm getting this issue too. Similar report at https://discuss.newrelic.com/t/typeerror-null-is-not-an-object-evaluating-elt-parentnode/43075. @borg4242 said he was using New Relic browser and I am also, but are all of you?

Building off the comment by @bflora2, the GSA in the user agent seems very key here and I've looked at a handful of instances of my errors and this lines up. The IPs were from various home ISPs too, so some kind of appliance (especially one that could MITM and add code) wouldn't make sense.

http://superuser.com/questions/739863/ipad-user-agent-changes-depending-on-location-work-home indicates that GSA means Google Search App on iOS. The errors I'm getting are all from iOS 10.0-10.1.1 so this would make perfect sense. I'm not sure how the app works, but maybe it can inject code into the web view and perhaps that's what's erroring out.

I fired up the simulator to try and reproduce this initially, but since it seems GSA related, I can't test without an actual iOS device since you can't install apps in the simulator.

Anybody care to verify this hypothesis?

@jgstratton
Copy link

I'm seeing the same elt.parentNode in my bug reports. Always GSA on iOS. Like wuservices, I don't have a device to test this on.

@pembo13
Copy link

pembo13 commented Nov 29, 2016

Just wanted to add to this. I'm using Rollbar for my monitoring, and I'm also catching this error on iPhones. No trace of this particular reference in the project code however.

@Terbiy
Copy link

Terbiy commented Dec 9, 2016

Here is one more GSA. In last 100 events in our project the most repeated one was GSA/21.1.139288856.

@mrredbit
Copy link

mrredbit commented Dec 9, 2016

Seems to be related to zoom in/out in the GSA. Whenever I zoom in/out my website, this event triggered.

@Paxa
Copy link

Paxa commented Dec 29, 2016

We ran into same issue, it happen when open page with Google app for iphone https://itunes.apple.com/us/app/google-app-search-made-just/id284815942?mt=8

But website working just fine, so we just ignore it

@elicia-nc
Copy link

We're hitting our quota in Sentry due to so many of these events. Is there a way to filter this event? Ignoring the event still counts toward the quota.

@Paxa
Copy link

Paxa commented Jan 5, 2017

shouldSendCallback should help you.

Raven.config('https://<key>@sentry.io/<project>', {
  shouldSendCallback: function (data) {
    // do something with data.exception
  }
}).install();

@Antman261
Copy link

Why not

Raven.config('https://<key>@sentry.io/<project>', {
  ignoreErrors: [ "null is not an object (evaluating 'elt.parentNode')" ]
}).install();

Intuitively I would expect ignoring at this level should prevent the event being sent, while ignoring from the Sentry dashboard would stop it from cluttering the UI but still count towards the quota?

@benvinegar
Copy link
Contributor

Intuitively I would expect ignoring at this level should prevent the event being sent, while ignoring from the Sentry dashboard would stop it from cluttering the UI but still count towards the quota?

This is correct.

@benvinegar
Copy link
Contributor

benvinegar commented Jan 25, 2017

I'm going to investigate adding something to our 3rd-party inbound filter to reject this, probably on user agent match ("GSA/22.*").

Any comments/objects on that? Note that events filtered by our official filters do not count towards your organization quota.

@adamreisnz
Copy link
Author

adamreisnz commented Jan 25, 2017

@benvinegar I think that'd be great, it seems this error is captured by a lot of apps out there and is basically just noise that we can't really do anything about anyway in our apps. I was going to create an ignore rule for it in all my apps, but if it can be done on a Sentry level that'd be excellent.

@benvinegar
Copy link
Contributor

benvinegar commented Jan 25, 2017

Yeah, I'm just debating how to put this in our filters.

e.g. do we add Google Search app as a "legacy browser", giving you the ability to reject all errors from that browser?

Or do I add an entry for "(evaluting elt.parentNode)" in our 3rd-party extensions filter?

I'm leaning towards the latter: this is not a 3rd-party extension per-say, but it's probably more in line with what people expect from that filter (throw out errors that don't belong to them).

@adamreisnz
Copy link
Author

I agree, judging by the responses in this thread, this error seems to be unique enough to make it safe to filter on the "(evaluating elt.parentNode)" string.

The only risk is that it would block legitimate errors if someone uses the elt short name in their code and somehow manages to trigger a similar error, but I think those cases would be rare.

@benvinegar
Copy link
Contributor

The only risk is that it would block legitimate errors if someone uses the elt short name in their code and somehow manages to trigger a similar error, but I think those cases would be rare.

I comment in getsentry/sentry#4823 about this. TL;DR the risk is low because this is a Safari-specific error message, so if you had a legitimate error with the same variable/property names, it would manifest in other more popular browsers.

@benvinegar
Copy link
Contributor

So, getsentry/sentry#4823 is now merged, which means that as soon as it deploys (within hours), you can enable the "Filter out errors known to be caused by browser extensions" inbound filter to filter/suppress this error. It will not count towards your quota.

You can find this at: Project → Project Settings → Inbound Filters

image

@mrredbit
Copy link

mrredbit commented Mar 9, 2017

Hi knorthfield, try zooming in/out in the GSA. Whenever I simply zoom in/out my website with no browser extensions, this event triggered, hope this help.

@stonyau
Copy link

stonyau commented May 1, 2017

After a few hours of "investigation", I accidentally found out that the only way you can reproduce this bug is simply downloading "Google Search" on your iPhone. I guess someone has figured it out.

@heejongahn
Copy link

I'm getting multiple null is not an object (evaluating 'element.tagName') errors in my project. The code I've written doesn't reference any of element.tagName at all(lib codes might). Maybe it could be related to this issue and I could just ignore it, I guess?

@zabbas44
Copy link

i was getting the same error for drag drop library, it was specific for safari 14 version, i think its variable type issue, code which was used by library was
DD.dropLoad = null;
to resolve the issue i have changed to
DD.dropLoad = new Object();

this has resolved my problem, i hope this helps someone else as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests