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.

Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')

See original GitHub issue

Hi. I just tried to use this library for the first time, got the error:

Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
    at partytown-sandbox-sw.js:304
    at Array.map (<anonymous>)
    at readMainPlatform (partytown-sandbox-sw.js:300)
    at accessRsp.$msgId$ (partytown-sandbox-sw.js:373)
    at Worker.worker.onmessage (partytown-sandbox-sw.js:422)
(anonymous) @ partytown-sandbox-sw.js:304
readMainPlatform @ partytown-sandbox-sw.js:300
accessRsp.$msgId$ @ partytown-sandbox-sw.js:373
worker.onmessage @ partytown-sandbox-sw.js:422

here docImpl.createElement("i").constructor.name returns b, and win.b is undefined. 🤷‍♀️

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
davidmerriquecommented, Dec 10, 2021

@adamdbradley I’m getting a similar error. All browsers, Chrome, FF, Safari

I have it set up like this

<script>
    partytown = {
      lib: "/js/~partytown/",
      debug: true,
      forward: [['dataLayer', 1]],
      logCalls: true,
      logGetters: true,
      logSetters: true,
      logImageRequests: true,
      logMainAccess: true,
      logSendBeaconRequests: true,
      logStackTraces: false,
      logScriptExecution: true,
    };
  </script>
<script src="/js/~partytown/debug/partytown.js"></script>
<script type="text/partytown">
  (function (window, document, i) {
    window['dataLayer'] = window[dataLayer] || [];

    window['dataLayer'].push({ 'gtm.start': new Date().getTime(), 'event': 'gtm.js' });

    var firstScript = document.getElementsByTagName('script')[0];
    var gtmScript = document.createElement('script');
    var dataLayer = 'dataLayer' != 'dataLayer' ? '&l=' + 'dataLayer' : '';

    gtmScript.async = true;

    gtmScript.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dataLayer;

    firstScript.parentNode.insertBefore(gtmScript, firstScript);
  })(window, document, 'GTM-REDACTED');
</script>

And i’m getting this error:

url: https://www.googletagmanager.com/gtm.js?id=GTM-REDACTED TypeError: Cannot read properties of undefined (reading 'createElement')
    at eval (eval at re (partytown-ww-sw.js:1), <anonymous>:36:242)
    at eval (eval at re (partytown-ww-sw.js:1), <anonymous>:36:402)
    at eval (eval at re (partytown-ww-sw.js:1), <anonymous>:37:271)
    at eval (eval at re (partytown-ww-sw.js:1), <anonymous>:48:326)
    at Proxy.eval (eval at re (partytown-ww-sw.js:1), <anonymous>:493:3)
    at re (partytown-ww-sw.js:1)
    at partytown-ww-sw.js:1
1reaction
eliseumdscommented, Jan 5, 2022

It conflicts with gpt.js:

<script src="//securepubads.g.doubleclick.net/tag/js/gpt.js" />
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - TypeError: Cannot read properties of undefined ...
I'm trying to use express at my React-Typescript SPA. But It's giving me the error: TypeError: Cannot read properties of undefined (reading ' ......
Read more >
Uncaught TypeError: Cannot read properties of ... - GitHub
Getting this with version 0.4.23: Uncaught TypeError: Cannot read properties of undefined (reading 'prototype') at sax.js:222:46
Read more >
Cannot read properties of undefined (reading 'prototype')
Since yesterday I have been getting this error, seems to have started when you V2 was launched, not sure why I am getting...
Read more >
[Solved] TypeError: Cannot read properties of undefined ...
To Solve TypeError: Cannot read properties of undefined (reading 'prototype') Error You Need to instantiate express in this way.
Read more >
Uncaught TypeError: Cannot read property 'prototype' of null
I just logged into my openERP account and this openERP Client error pops out. And I can't access to any of the modules...
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