Is there a way to remove "TypeError: Expected signal to be an instanceof AbortSignal"?
See original GitHub issuehttps://github.com/node-fetch/node-fetch/blob/master/src/request.js?ts=2#L120
This line causing problem
Let’s check out ths isAbortSignal
function
When would it happen?
After Webpack bundle my code, code minification would change the name,
object[NAME] === 'AbortSignal'
is not true anymore
so this error would pop up,
The only solution is to turn off code minification
There should be a better way than this
Propose (What to do next)
- Delete this part altogether, don’t check the name
- Don’t compare with string ‘AbortSignal’ like this
object[NAME] === 'AbortSignal'
, in Ruby we haveclass.name
to get the class name, I am not sure what’s the equivalent in JS
Maybe this StackOverflow question helpful: How to get a JavaScript object’s class?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Error with Lambda Function running on NodeJS netlify ...
My function always seems to return an error in development which says Function invocation failed: TypeError: Expected signal to be an instanceof ......
Read more >[JS Client] Expected signal to be an instanceof AbortSignal
When webpacking in production mode for nodejs an application that uses Ktor JS client with new IR compialtion backend and running it, any...
Read more >AbortSignal - Web APIs - MDN Web Docs - Mozilla
The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort ......
Read more >The complete guide to AbortController in Node.js
Introduction to AbortSignal; How to use AbortSignal to time out async ... The code below shows how to add and remove the abort...
Read more >Realm js: Expected signal to be an instanceof AbortSignal
Hi! i am using realm node sdk with electron-forge configuration and also creating an api with contextBridge. when i load the application in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For those using esbuild, an equivalent solution to 1c7’s solution is to set the “keepNames” option to true.
https://esbuild.github.io/api/#keep-names
Done, fixed it
Enviroment
Solution:
This can still minify code, but, without mangle with the class name and function name
vue.config.js
Result (This worked)
This is
src/background.js
file after runningnpm run electron:build
For comparison (This doesn’t work)
node-fetch
would raise error