question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError in gtm plugin: undefined is not an object

See original GitHub issue

I have no idea why do I continue to get errors ‘TypeError: undefined is not an object (evaluating ‘n[t].src.match’)’. Example of report in bugsnag: https://i.imgur.com/cLfm60Y.png https://i.imgur.com/H2pgIDn.png It refers to this lines in source code:

  const scripts = document.querySelectorAll('script[src]')
  return !!Object.keys(scripts).filter(key => scripts[key].src.match(regex)).length

I can’t even imagine when scripts[key].src in these lines could be undefined. Anyway, we can replace scripts[key].src.match with (scripts[key].src || '').match.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidWellscommented, Mar 13, 2020

Published to @analytics/google-tag-manager@0.2.3

https://github.com/DavidWells/analytics/releases/tag/%40analytics%2Fgoogle-tag-manager%400.2.3

Let me know if that doesn’t fix it 😃

0reactions
zobzncommented, Mar 15, 2020

So far so good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ErrorScreen] undefined is not an object (evaluating ...
Hi,. I am facing a issue in my mobile application,. Often i am getting this screen. and the error log says this.
Read more >
undefined is not an object (evaluating 'tracker.get')
I have code straight from the google analytics docs. For some reason get an error, only sometimes undefined is not an object (evaluating ......
Read more >
Is Google Tag Manager Preview Mode Not Working? 22 Ways ...
Is Google Tag Manager Preview mode not working? Here are 22 ways to solve this problem and continue working on your GTM implementation....
Read more >
I cannot get an error to go away caused by Google Tag Manager
I go to inspect a page on my site and go to "Console" and I see this error: Uncaught TypeError: Cannot set property...
Read more >
Uncaught TypeError: Cannot read property of undefined
Out of the six primitive types defined in JavaScript, namely boolean, string, symbol, number, Null, and undefined, no other type throws as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found