fetch() not working

fetch doesnt seem to return anything
No description
13 Replies
Dullaz
Dullaz11mo ago
‘await’ the fetch no?
kaneki
kanekiOP11mo ago
tried doesnt work
Dullaz
Dullaz11mo ago
Ahh but on cf workers you might need to use waitUntil on async functions The worker might be terminating before it finishes
kaneki
kanekiOP11mo ago
still no log
No description
kaneki
kanekiOP11mo ago
ohh
Walshy
Walshy11mo ago
these are promises - await them await the fetch and await the .json
kaneki
kanekiOP11mo ago
i see
Walshy
Walshy11mo ago
MDN Web Docs
Using the Fetch API - Web APIs | MDN
The Fetch API provides a JavaScript interface for accessing and manipulating parts of the protocol, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.
kaneki
kanekiOP11mo ago
did still doesnt return anything
No description
Walshy
Walshy11mo ago
is your sendmsg function being awaited?
kaneki
kanekiOP11mo ago
console.log(ctx) in this function works fine it stops exactly at line 12 the res variable
kaneki
kanekiOP11mo ago
SOLVED
No description
Dullaz
Dullaz11mo ago
Nice! Thought it might be that

Did you find this page helpful?