Skip to content

Is there a reason why my very simple fetch response.text() never resolves? #20533

@Alanz2223

Description

@Alanz2223

Hello, I am making a request to a URL and the request is not formatted as JSON yet whenever I call response.text() my promise never resolves. The response text is a bit lengthy, so could that be a possible factor? Are there any alternatives to Fetch that could resolve this?
fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text().then((mu) => console.log('mu' + mu)); })

The console never prints out the mu variable, yet whenever I try response.json() I get a unexpected token error cannot parse "<" ..etc which correctly indicates that fetch was able to obtain the HTML page and the response HTTP status is 200.

I've also tried the alternative

fetch('https://www.youtube.com/watch?v=4Tr0otuiQuU') .then(response => { return response.text() }) .then(.mu => console.log('mu' + mu))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions