You need to remove the
{"mode": "no-cors"}
option from your
fetch
request.
no-cors
... In addition, JavaScript may not access any properties of the resulting Response.
If you leave the mode as
no-cors
and display the result of
resp.text()
, you will see that the response content is empty.
After removing the
mode
option, the response content will be returned correctly, and your
resp.json()
call will work.