Skip to content

Is there a way to remove "TypeError: Expected signal to be an instanceof AbortSignal"?  #784

@1c7

Description

@1c7

https://github.com/node-fetch/node-fetch/blob/master/src/request.js?ts=2#L120

This line causing problem

image

Let's check out ths isAbortSignal function

image

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)

  1. Delete this part altogether, don't check the name
  2. Don't compare with string 'AbortSignal' like this object[NAME] === 'AbortSignal',
    in Ruby we have class.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions