Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda