Skip to content

node-fetch v2 does not work but node-fetch v3 works #1655

Answered by jimmywarting
sibelius asked this question in Q&A
Discussion options

You must be logged in to vote

i figured out that they do send out different response depending on what user-agent you are using...
it seems as if they have banned node-fetch/* as a bad bot or something.

if i send a 'user-agent': 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)' then i get a 403 Forbidden text/html response
(it's not even a json response so calling await res.json() will throw a error)

In v3 we changed the user agent to just be: node-fetch to not leak as much information about what version we are using

but if i send 'user-agent': 'random' then i get back 400 Bad Request (saying that i'm just missing some credentials.
{"error":"Invalid Request","description":"Invalid authorization header: ","field…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@jimmywarting
Comment options

@sibelius
Comment options

@sibelius
Comment options

@jimmywarting
Comment options

@sibelius
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@sibelius
Comment options

@LinusU
Comment options

@jimmywarting
Comment options

Answer selected by sibelius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #1654 on September 27, 2022 14:46.