Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Firebase Functions CORS Policy Disallowing Calls

I've been using Firebase functions emulator to develop the following function and had no issue running it from localhost.

exports.functionName = functions.https.onCall(async (data, context) => {
    const var1 = data.var1
    const var2 = data.var2

    const paymentIntent = await object1.property1.function1({
        ...
    });

    return({
        clientSecret: paymentIntent.client_secret
    })
})

Now that I deployed it on firebase (on the default url of projectName.web.app), when I reach the code which fetches this function, I get the following error:

Access to fetch at 'https://us-central1-projectName.cloudfunctions.net/functionName' from origin 'https://projectName.web.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Why am I getting this error, especially if it's coming from a call made on deployed website hosted by firebase? What can I do to get through this, and will that open me up to any security risks?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda