google-cloud-functions

Cloud Scheduler invokes Cloud Function more than once during schedule

Cloud Scheduler invokes Cloud Function more than once during schedule Question: I currently have a Cloud Function that is executing some asynchronous code. It is making a Get request to an Endpoint to retrieve some data and then it storing that data into a Cloud Storage. I have set up the Cloud Function to be …

Total answers: 2

Call shell script from within Google Cloud function

Call shell script from within Google Cloud function Question: I am trying to invoke a simple shell script in a Google Cloud Function using Python. However, for some reason the script cannot be found even though I found out that it is in the same directory on the environment . The script of my main.py …

Total answers: 2

How do I split a PDF in google cloud storage using Python

How do I split a PDF in google cloud storage using Python Question: I have a single PDF that I would like to create different PDFs for each of its pages. How would I be able to so without downloading anything locally? I know that Document AI has a file splitting module (which would actually …

Total answers: 3

How to use the Python pdf2image module (thus poppler) on Google Cloud Function?

How to use the Python pdf2image module (thus poppler) on Google Cloud Function? Question: I tried convert PDF to JPEG on Google Cloud Functions. I used the Python module pdf2image. But I have no idea how to solve the errors No such file or directory: ‘pdfinfo’ and "Unable to get page count. Is poppler installed …

Total answers: 3

ListRecommendationsRequest constructor error in Python script

ListRecommendationsRequest constructor error in Python script Question: I am trying to prepare a VM Resizing Recommendations Report using a Python 3.7 script. My code is as follows: import datetime import logging from google.cloud import bigquery from google.cloud import recommender from google.cloud.exceptions import NotFound from googleapiclient import discovery def main(event, context): client = recommender.RecommenderClient() recommender_type = …

Total answers: 1

How to open a file in binary mode in google storage bucket from cloud function?

How to open a file in binary mode in google storage bucket from cloud function? Question: In my cloud function, I need to get a file in cloud storage and send the file to an API through HTTP POST request. I tried the following code: storage_client = storage.Client() bucket = storage_client.bucket(BUCKET_NAME) source_blob_name = "/compressed_data/file_to_send.7z" blob …

Total answers: 2

Access to fetch `url` been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. ReactJS

Access to fetch `url` been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. ReactJS Question: I’m am trying to fetch a serverless function from a react app in development mode with the following code. let response = await fetch(url, { method: ‘POST’, mode: ‘cors’, body: "param=" + paramVar, }) .then(response …

Total answers: 4

VS Code multi-root workspace with one top level git repo

VS Code multi-root workspace with one top level git repo Question: I am working on a project that requires multiple Google Cloud Functions. Each Cloud Function has its own virtualenv because each has its own Python dependencies. All the Cloud Functions are related so I’ve added each folder containing the Cloud Function code to a …

Total answers: 2