Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!