Fetch request just hangs
Hi,
I'm trying to debug an issue where a request I'm trying to make to grab some markup just hangs and I can't figure out why. It is worth noting that this request works just fine when using Dio straight from dart. Other requests to the same website also resolve successfully from the JS environment.
My dart code:
JsEvalResult searchRequest = js.evaluate("$src.getChapters(`$id`);");
var newResult = await js.handlePromise(searchRequest);
The offending JS:
export const getChapters = async (mangaId: string): Promise<IChapters> => {
console.log("starting");
try {
const results = await fetch(`${MF_URL}/manga/${mangaId}`);
console.log(await results.text());
return parseChaptersResult(await results.text(), mangaId);
} catch (e) {
console.log("err");
console.log(e);
}
return { chapters: [] };
}
It's worth noting that the JS begins to process just fine as that first console.log executes but the promise never appears to resolve, it could also be worth noting that the response is quite a significant html page. For example, the request seems to resolve on a page that's 5.5kb but just hangs when the page is 21kb? At the moment that's the only obviously differenatiator I've got.
@wardy484 Same problem for me fetch hangs!! did you find any fix?
I did not in the end I've wound up (hopefully temporarily) running the JS on a remote host.