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

236
Visualizações
Call Google Cloud Function from front-end application

I am implementing a react-native application. Essentially, from this front-end application, I want to make an GET request to the Yelp Fusion API, which requires a Private API Key (which I have saved in my notes).

Considering a GET request with a private key should be executed from the server-side, and not the front-end react-native application, I wanted to implement this functionality through either Google Cloud Functions, or Firebase Functions.

Essentially, how do I trigger an event like this from a front-end Javascript client, and what do I need to set up on Firebase or Google Cloud Functions for this to work?

I was able to write a function in Firebase Functions, but I wasn't sure how to write a GET request to a URL external to the Google Cloud Platform. I also do not know how to trigger the request and receive data from the client side.

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

0

You can create a Cloud Function with a public HTTP trigger to accomplish this.

The samples on that page include HTTP based Cloud Functions.

Here's the doc on calling http triggers.

To deploy a Cloud Function with an public HTTP trigger:

gcloud functions deploy MYFUNCTION --runtime <your runtime> --trigger-http --allow-unauthenticated

This command allows anonymous access to call your functions, ordinarily you would need to be authenticated to do so.

Once you open a trigger to the internet though anybody can call it so keep that in mind with what data you accept and pass back. You may also want to set a budget on the project containing the function in case somebody were to calling it continuously racking up a bill for you.

about 4 years ago · Juan Pablo Isaza Relatório

0

Cloud Functions for Firebase are a thin wrapper around Google Cloud Functions, so any approach that you can use for GCF (such as the one Jake proposes in their answer) also works on Firebase.

There are two ways to directly invoke a Cloud Function from within your application code with Firebase:

  1. Create a HTTP endpoint and call that from your application code using something like fetch. This is described in the documentation on Call functions via HTTP requests
  2. Implement a so-called Callable function in Firebase and then invoke that from your application code through the SDK. For more on this, see the documentation on Call functions from your app.

The second type essentially wraps the first type, but adds some features like named parameters, and it automatically passes the ID token and some other parameters.

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