Uncaught (in promise) error
Hey, I'm tryna make a file uploading system. My full code is https://pastebin.com/dUCApxp4, but this should be the important part:
However, when I sent a
PUT
request with the valid headers and data, it returns 500, and the logs show Uncaught (in promise) TypeError: Incorrect type for Promise: the Promise did not resolve to 'Response'.
. I've been trying to fix this for a very long time, so any help would be appreciated!10 Replies
return new Response("helo mate")
You're just returning a string, not a ResponseAh yep, I changed that to be a string, thinking that might be the issue. Changing it back now didn't fix the issue however
This is the next part (for getting files) and it works fine:
return "no, go away"
is also wrongoop that may be it
in the second to last line, you are returning
"helo mate"
, a string - which should be return new Response("helo mate")
that was rather slow to send, thanks discord:P
ah yeah that fixed the issue! tysm!
well it fixed that issue
I assume its me being dumb because I've never used records before, but it's now a
Record only exists as a type in TS, you construct one with just
{}
you might be thinking of Map
s?oop i really need to brush up on my ts, innit mate
thanks!
finally all works, woohoo
glad you got it working!