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.

Bug: I get "TypeError: Illegal invocation" when using node-fetch@3 with electron

See original GitHub issue

I’m not sure if this is a bug but I think so. I have an electron app that uses node-fetch@2 which is working fine (in a GUI and the terminal), but with version 3 when I only run the app in the terminal (I get a TypeError when run in the GUI).

This is maybe due to dropping support for the browser but I don’t think so! The app uses node-fetch in the GUI using a preload script which have access to full node APIs as far as I understand, and it should be running as if it’s running from a terminal! Or maybe it’s an issue with Electron itself?!

Reproduction

Steps to reproduce the behavior: Using node >=12.14.1 should be fine but I use version 14.8.0.

  1. git clone https://github.com/badersur/miniapp.git
  2. cd miniapp
  3. git checkout node-fetch-3
  4. yarn
  5. yarn dev

Edit: Or download v1.0.1-next of the app and run it to see the error on the GUI, and run miniapp -t to output to the terminal with no error!

Expected behavior The app should work fine as shown in the master branch:

git checkout master
yarn
yarn dev
# Passing `-t` to the app will output to the terminal (which is working fine using both versions), for Linux I use:
yarn dist:dir && ./dist/linux-unpacked/miniapp -t

Edit: Or download v1.0.0 of the app and run it with or without -t flag to see the app running without any issues!

Screenshots

Screenshot from 2020-08-18 18-11-01

Your Environment

software version
node-fetch 3.0.0-beta.8
node 14.8.0
npm 6.14.7
yarn 1.22.4
Operating System Ubuntu 20.04.1 LTS

Additional context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JosephusPayecommented, Mar 4, 2021

Just ran into the same issue. Is there anything we can do to help fix the issue?

0reactions
xxczakicommented, Sep 8, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

"Uncaught TypeError: Illegal invocation" in Chrome
In your code you are assigning a native method to a property of custom object. When you call support.animationFrame(function () {}) , it...
Read more >
Uncaught TypeError: Illegal invocation - jQuery Forum
Hi, I am getting the above error and can't figure our why? kindly help.. This is my code: var formData = new FormData(); ......
Read more >
"Illegal invocation" errors in JavaScript - Matias Kinnunen
I encountered the "illegal invocation" error when calling the destructured abort method of an AbortController :
Read more >
Illegal invocation" error thrown in js-agent.newrelic.com ...
We have a PHP integration with New Relic in our SAAS application, and we're having intermittent issues with the JS. In particular, this...
Read more >
jQuery Error - Uncaught TypeError: Illegal invocation - YouTube
In this video tutorial I will show you how to solve jQuery error "jQuery Error - Uncaught TypeError : Illegal invocation ". I...
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