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

162
Visualizações
Google Cloud Function not receiving input from client

I have incoming data to my Google Cloud Function and for some reason, my Google Cloud Function is getting the input from the client side in an incorrect format and is causing it to pass an undefined value to a web scraper I am attempting to build. I have tried passing the data as input = JSON.parse(req.body.input) and destructing it from the req.body and then parsing it and that did not work either. Attached here is the Google Cloud Function code as well as my client-side request (I think the client-side is OK, but I am a newbie so I could be completely off. The URL being passed into the fetch isn't the real URL, not posting it because I don't want that URL out in the open.) Any help for this struggling junior would be super appreciated!

Google Cloud Function

 * Responds to any HTTP request.
 *
 * @param {!express:Request} req HTTP request context.
 * @param {!express:Response} res HTTP response context.
 */
const puppeteer = require("puppeteer");

exports.webScrape = async (req, resp) => {
    resp.header('Access-Control-Allow-Origin', '*')
    console.log('working woot woot')
    console.log(req.body)
resp.send('hello world')
};

Client-side request

      try {
        this.$emit("loading", true);
        console.log("getting the scraper");
        console.log(`here is input ${input}`);
        //" "" "
        const response = await fetch(
          "myURL",
          {
            method: "POST",
            mode: "cors",
            headers: {
              "Content-Type": "application/json",
              "Allow-control-allow-origin": "*",
            },
            body: JSON.stringify({ input }),
          }```
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