Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Why do I get an empty response from fetch call?

I have Azure function app written in python. App works in azure editor fine and in calling request from python also fine. But when I want to call it from client side javascript (from my react app) I get empty response

I call it in this way:

    fetch("https://xxxxx.azurewebsites.net/api/testtrigger?", {
        mode: 'no-cors',
        method: 'GET'
    }).then(response => response.text()).then((response) => {
        console.log(response)
    })

The no-cors is there because I test it on localhost.

Function code looks like this:

import logging

import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Function called')
    return func.HttpResponse("Its working")

Azure shows that function is being called, but is there any reason I missed why this should't work? I receive response but its empty, here is response json:

     Response {type: 'opaque', url: '', redirected: false, status: 0, ok: false, …}
body: (...)bodyUsed: falseheaders: Headers[[Prototype]]: Headersappend: ƒ append()delete: ƒ delete()entries: ƒ entries()forEach: ƒ forEach()get: ƒ ()has: ƒ has()keys: ƒ keys()set: ƒ ()values: ƒ values()constructor: ƒ Headers()Symbol(Symbol.iterator): ƒ entries()Symbol(Symbol.toStringTag): "Headers"[[Prototype]]: Objectok: falseredirected: falsestatus: 0statusText: ""type: "opaque"url: ""[[Prototype]]: Response

This code in python works fine:

import requests
x = requests.get('https://xxxxx.azurewebsites.net/api/testtrigger')
print(x.text)
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

no-cors is an explicit directive to fetch to tell it not to do anything that requires the server to use CORS to grant permission.

Reading the response body requires permission.

Since you said no-cors you get an empty body instead of the data the server responded with.

about 4 years ago · Juan Pablo Isaza Report

0

So bassicaly answer for this is - I can't call azure functions from client side browser on local host, I have to add to my package.json:

  "proxy": "https://xxxxxxx.azurewebsites.net",

and fetch in with:

fetch("/api/testtrigger")
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!