Bug: I get "TypeError: Illegal invocation" when using node-fetch@3 with electron
See original GitHub issueI’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.
git clone https://github.com/badersur/miniapp.git
cd miniapp
git checkout node-fetch-3
yarn
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
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:
- Created 3 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top GitHub Comments
Just ran into the same issue. Is there anything we can do to help fix the issue?
cc @tinovyatkin