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

328
Visualizações
cloud function testing failing "Invalid request, unable to process."

I have written a simple cloud function which I also deployed already to firebase and the code works. It is the following function:

exports.testfunction = functions.https.onCall(async (data) => {
     const mydata = JSON.parse(data)
     const mydata1 = JSON.parse({const1: "AAA", const2: "BBB", const3: "CCC"})
     return{mydata1}
 });

Now that I want to test this function localy, Im running the following command in my terminal: firebase emulators:start and I get no errors so far. Anyways as soon as I try to call the function with http://localhost:5001/MYPROJECTNAME/us-central1/testfunction in my browser, Im receiving the following error message which I can not find any workaround for:

{"error":{"message":"Bad Request","status":"INVALID_ARGUMENT"}}

The thing is, the function itself is working great if I deploy it and call it from inside my app, but Im failing to run it from my firebase emulator inside the console. What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As explained in the documentation for Callable Cloud Functions:

It's important to keep in mind that HTTPS callable functions are similar but not identical to HTTP functions. To use HTTPS callable functions you must use the client SDK for your platform together with the functions.https backend API (or implement the protocol).

So, if you want to directly call the function via it's URL, your HTTP Request needs to follow the protocol specification for https.onCall.

about 4 years ago · Juan Pablo Isaza Relatório
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