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.

Illegal invocation on transport file

See original GitHub issue

Since April 9th I started seeing errors that I can’t reproduce reaching my users and it seems be more frequently.

I’m using @datadog/browser-rum 2.7.1 which depends on @datadog/browser-core 2.7.1

The raw error is:

TypeError: Illegal invocation
  at e.send(../../../src/transport/transport.ts:22:34)
  at e.flush(../../../src/transport/transport.ts:68:20)
  at apply(../../../src/transport/transport.ts:153:12)
  at n(../../src/helpers.ts:87:17)

Line 22 on the source map is:

    HttpRequest.prototype.send = function (data, size) {
        var url = this.withBatchTime ? addBatchTime(this.endpointUrl) : this.endpointUrl; // <== this one
        if (navigator.sendBeacon && size < this.bytesLimit) {
            var isQueued = navigator.sendBeacon(url, data);
            if (isQueued) {
                return;
            }

On file @datadog/browser-core/esm/transport/transport.js.

But this does not seem to make sense as the error is e.send so it is happening when send is called.

It seems to happen in any browser (Chrome 70/79/80/89, Mobile Safari, Samsung Internet, Chrome Mobile are some examples). I could not reproduce it yet.

Any thoughts or ideas are welcome.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
bcaudancommented, Apr 19, 2021

the two linked PRs has been released in 2.7.4, let us know how it goes

1reaction
BenoitZugmeyercommented, Apr 23, 2021

@igrayson: In your screenshot, we can see that the exception is triggered at a place where window.navigator.sendBeacon is used followed by a window.fetch fallback, which is not done in our codebase. So, this is not the same issue, and probably not related to the RUM Browser SDK (as it does not instrument navigator nor sendBeacon)

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Illegal Invocation - Stack Overflow
“Illegal invocation” happens when you call native API with a wrong context object. $c should be the builtin navigator interface, navigator.
Read more >
Illegal invocation caused by sendBeacon() call in gtag.js ...
I just wanted to try explicitly setting the transport type to beacon and see if those browsers are still the only ones where...
Read more >
Uncaught TypeError: Illegal invocation · Issue #628 - GitHub
I will try to reproduce this. Sorry, i mean the omnisharp flame button , in it's documents it says "To use. Open a...
Read more >
"Illegal invocation" errors in JavaScript - Matias Kinnunen
An "illegal invocation" error is thrown when calling a function whose this keyword doesn't refer to the object where it originally did. In...
Read more >
Jquery and HTML FormData returns "Uncaught TypeError
I'm using this script to upload my image files: http://jsfiddle.net/eHmSr/ ... Uncaught TypeError: Illegal invocation. jQuery Error. Can you help me?
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