All Questions
Tagged with google-cloud-run python
262 questions
2
votes
0
answers
65
views
Cloud Run installs JS Modules every call
I have a cloud run function in python, and some JS files. The python code calls the JS code via processes. For some reason every time I call the cloud run function it seems to install jsdom which ...
0
votes
0
answers
32
views
Python Google Cloud Function issue with "requested_run_time"
I have a process in GCP that can be summarized as:
a log sink checks the logs for a specific log (daily GA4 table is added to the dataset)
when sink gets the log, a pub/sub message is sent to trigger ...
0
votes
0
answers
93
views
How to save a file to a cloud storage bucket from a cloud run function
I am super new to using google cloud and a very novice coder. I am trying to create an automated system that saves a graph as a jpeg in a cloud storage bucket (this will be a cloud run function that ...
2
votes
0
answers
42
views
Support CONNECT flask server
I am trying to build a basic proxy server thats accessible form the internet to forward requests but also log them to firebase database. I deployed my code on Google Cloud Run by creating an instance ...
0
votes
0
answers
22
views
Can custom headers be added to automatically generated Cloud Logging logs in Cloud Run?
A similar question was asked nearly two years ago, but there was no confirmed answer. Is it now possible to add custom attributes to the automatically generated logs in Cloud Run?
I’m not referring to ...
0
votes
1
answer
71
views
Cloud Run deployment from Github does not execute build. No logs
I built a flask app which I am trying to deploy to Google Cloud Run. My code base is on Github in a private repository. However, the following error occurs: "Cloud Build trigger was created, but ...
0
votes
0
answers
51
views
Cloud Run Fails to Import Custom Package from Artifact Registry (Terraform Deployment)
I'm deploying a Cloud Run function using Terraform, and the function depends on a custom Python package that we uploaded to Google Artifact Registry using Twine. However, the deployment fails with the ...
0
votes
0
answers
46
views
How to get ordered logs using GCP Pub/Sub
I am using the GCP Pub/Sub to get real-time google logs into my Python application.
I have created a log Sink that routes specific cloud run job logs into a Pub/Sub topic and I am subscribing to that ...
0
votes
1
answer
465
views
Error from Google Cloud Run - Deploying containers
I am getting this error when I am trying to deploy a simple python container in Google Cloud Run:
Revision 'flask-backend-00001-vxb' is not ready and cannot serve traffic. Cloud Run does not support ...
0
votes
0
answers
85
views
Is it possible to load a sentence transformer model from google cloud storage bucket mounted to a cloud run instance
Have saved a sentence transformer model from hugging face to a google cloud storage bucket with hierarchical namespace enabled. This bucket is then mounted to a google cloud run instance as a volume ...
0
votes
0
answers
138
views
How to authenticate and get credentials with Google OAuth 2.0 running in Cloud Run?
First of all, I'm very new to APIs and server settings.
I'm trying to get Google APIs credentials using the function I've made to gain access to use the Google Tasks API in my Python script (not shown ...
0
votes
0
answers
194
views
GCP pub-sub errors
I am building a simple webapp that accepts HTTP POSTs and should trigger a Cloud Pub-Sub event. Without pub-sub, the app deploys fine and I can reach the endpoint.
I've created a sample functions. I'...
2
votes
1
answer
102
views
HTTPS hearders but HTTP URL in FastAPI and Cloud Run
I created a FastAPI app and I can access the Swagger UI autodocs at https://cloudrundomain.app/docs. When I send an HTTPS request using the Swagger UI, the request.headers.get("X-Forwarded-Proto&...
4
votes
1
answer
977
views
GCF function testing in python: failed to fetch builder image
I regularly use Google Cloud Run to write functions using Python. When testing I am usually able to click "Test Function" at the top of the page which opens a console window at the bottom of ...
0
votes
0
answers
412
views
How to fix mixed content error when embedding a FastAPI app as iframe
I'm deploying a web application using NiceGUI (fastAPI) on Google Cloud Run. The main application is served over HTTPS, but I’m embedding a sub-application (Chainlit) as an iframe within the main app. ...
0
votes
0
answers
73
views
Fastapi on GCP cloud run not killing timeout request
we have a simple fastapi application deployed on GCP cloud run, The cloud run has a timeout of 15s but sometimes the downstream API call done by fastapi exceed this time.
We are experiencing that once ...
0
votes
0
answers
187
views
Can't decode event data in Cloud Run Function with a Firestore trigger
I have deployed a 2nd Gen Cloud Run Function with a Firestore trigger, on the google.cloud.datastore.entity.v1.written event. I have used the sample code shown in Google Cloud documentation:
from ...
1
vote
1
answer
71
views
GCP Cloud Run Container Behavior - ModuleNotFoundError
When Cloud Run runs a container image, the container fails differently than when I run it locally.
I added this try/except in app/main.py to debug the divergent behaviors:
print(f'cwd is {os.getcwd()}'...
0
votes
0
answers
385
views
GCP Cloud Run seems to not be serving the proper revision
I have a simple FastAPI API deployed using GCP Cloud Run, which serves as the back-end of a React webapp hosted in Firebase. The system was working fine and I would regularly create new revisions ...
0
votes
1
answer
263
views
Playwright works locally, but fails once deployed on to Google Run
I developed and successfully tested a python script locally that uses Playwright for web scraping.
TLDR: Python script logs into a website, goes to a different page, clicks on a few links and then ...
0
votes
0
answers
92
views
Cloud Run long CPU times and poor initial performance for Python app
I have a function that uses BigQuery API to retrieve a dataset and write it to a dataframe. Its a large dataframe of about 500k rows. It only runs at start time and locally takes about 27 seconds ...
0
votes
1
answer
78
views
Route works fine in local Docker container, but throws a stack trace error when deployed to CloudRun
I am working on an app in Python, using Selenium WebDriver (with Chrome / ChromeDriver) for web scraping.
My route works fine in a local Docker container (200, with the expected data returned ...
0
votes
1
answer
141
views
From Python code, how can I simulate a storage event to a Google Eventarc topic?
Setup:
Deploy a google cloud run service that simply logs exactly its POST payload
Create an eventarc that triggers when an object is finalized in a storage bucket that calls that cloud run service ...
1
vote
0
answers
136
views
Error occured from python joblib.load : persistent IDs in protocol 0 must be ASCII strings In GCP cloud run
Overall: I tried to build BERT model with Cloudbuild and Cloudrun. I saved the model (parameter) and metadata (labels) at the GCP Cloud Storage. But, I encountered the error from load metadata.bin ...
2
votes
0
answers
297
views
How can I get the CPU & Memory usage from a service in Google Cloud Run using python?
I want to create a resource tracker for my pipelines (the majority are deployed in a Cloud Run Service). so that I can save a log every time they run with the CPU & Memory usage, something like ...
0
votes
1
answer
260
views
Launch multiple server apps in localhost with different port numbers within the same container in Cloud Run
I'm creating a webapp with 2 main services: Flask and Chainlit.
When I launch my webapp locally on localhost:8080, on my landing page, when I click on the "chat" button, it redirects me to ...
1
vote
0
answers
133
views
Prefect with Google Cloud Run: Creating a New Execution ID for Each Flow in a Single Job
I am currently using Prefect cloud to orchestrate different tasks, and I am deploying these tasks as jobs on Google Cloud Run using the CloudRun Push workpool.
Here's the situation I am facing: every ...
2
votes
1
answer
195
views
Cloud Run in Google Cloud doesn't recognize time.sleep() in my Python script
I have a Cloud Run service running a Python script in a Docker container.
Running the script on a VM in GCP or locally works fine. It recognizes the time.sleep() in my script.
But Cloud Run does not. ...
27
votes
7
answers
13k
views
How to generate a Blob signed url in Google Cloud Run?
Under Google Cloud Run, you can select which service account your container is running. Using the default compute service account fails to generate a signed url.
The work around listed here works on ...
2
votes
0
answers
194
views
Google Cloud Function slow download speed (Gen 2 Cloud Run)
I have written a gen 2 cloud function with which downloads a large YouTube video at 1080p. Because of this, it downloads the video and audio separately. I have maximized the resources devoted to the ...
2
votes
1
answer
4k
views
Execute GCP Cloud Run job with environment variable override using Python client
I am trying to trigger a GCP Cloud Run job from a python script following the run_job documentation (https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.jobs....
0
votes
1
answer
136
views
Why does the psutil CPU tracker not work in Google Cloud Run?
I'm currently working on a Tracker of CPU & RAM in python using psutil. I've made some tries locally and everything appears to work fine, but, when I deploy to Google Cloud Run, the tracker is not ...
2
votes
0
answers
478
views
Google Cloud Job logs splitting single line log into multiple lines
I am running a python script in GCP cloud jobs and the logs are getting weirdly split into multiple lines. Pretty much unreadable. Is there a way to avoid this
log = getLogger()
log_formatter = ...
1
vote
1
answer
534
views
Increase timeout of API call to Cloud Run
I am triggering a cloud run job in GCP through airflow DAG. The job takes 30 minutes to execute, but the request timeout is 900 seconds so the DAG task fails.
The error is:
"Operation did not ...
0
votes
1
answer
161
views
Unavailable Meta's Prophet at GoogleCloudFunction runtime Python312
At GoogleCloudFunction, below code is unavailable.
from prophet import Prophet
model = Prophet()
model.fit(train_data)
Its python error is below,
RuntimeError: Error during optimization! Command '/...
0
votes
0
answers
409
views
Unable to connect to VertexAI from Cloud Run, but it works locally
EDIT
In my case, this was happening because of the VPC. I'm not sure how to configure things so that VertexAI is accessible via VPC (like I said below, I added the integration), but for now, I ...
0
votes
0
answers
126
views
Invalid HTTP_HOST header for Django app that is running in Cloud Run
I have a Django app running in Cloud Run. Cloud Run is configured as a backend service for External Application Load Balancer.
The service works with different custom domains. The list of domains is ...
1
vote
1
answer
43
views
Cloud Run - Authenticated request doesn't work on custom (sub)domain
I have a Cloud Run service running with authenticated requests turned on. I've created a domain mapping using Load Balancing to point a subdomain to the container.
I have been sending requests to the ...
1
vote
1
answer
851
views
Flask app cannot run on google cloud run: service unavailable 503 error
I created a web app with Flask that exposes the 8080 port and shows some html pages, and I deployed it with google cloud run.
This is the basic code.
app = Flask(__name__)
@app.before_request
def ...
30
votes
5
answers
37k
views
"[CRITICAL] WORKER TIMEOUT" in logs when running "Hello Cloud Run with Python" from GCP Setup Docs
Following the tutorial here I have the following 2 files:
app.py
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello():
"""Return a ...
1
vote
1
answer
896
views
ModuleNotFoundError on Google Cloud Run, not locally
I am deploying a Python Flask application behind gunicorn on Google Cloud run. The container runs fine locally, but I notice when I build and push the service revision I get an error and my gunicorn ...
1
vote
2
answers
3k
views
How do I make a Dockerfile for Cloud Run?
I am deploying and running Python Jobs to Cloud Run. I can successfully deploy and run my jobs, and they behave as expected.
I am adding import requests to my job, and it is giving me the error:
...
0
votes
1
answer
260
views
Dockerfile runs runs locally but fails on Google Cloud Run
I have a Dockerfile, shown below:
FROM --platform=linux/amd64 prefecthq/prefect:2-python3.12
RUN apt-get update && apt-get -y install libpq-dev gcc
RUN pip install --upgrade pip
RUN pip ...
0
votes
1
answer
374
views
Django - CSRF verification failed in Cloud Run
EDIT: I tried doing the tutorial again. It now works perfectly so I must have mistyped something in my last attempt
I am following this tutorial from Google codelabs. When trying to login to the admin ...
0
votes
0
answers
579
views
How do I deploy a Python Flask App that uses Playwright on Google Cloud Run?
I'm trying to deploy a Python Flask App that uses Playwright on Google Cloud Run with a docker image. I've read from this that you'd need to use the Playwright Python images provided by Microsoft. ...
0
votes
0
answers
348
views
Google Cloud Run deploy from source with a specific Python version
I'm running into issues with my type-hinted Python code on Google Cloud Run when deploying from source and believe this to be because Cloud Run is not running my code on Python >= 3.9. Is there a ...
4
votes
1
answer
2k
views
Google Cloud Run Jobs logging splits Exception MESSAGES with multiple lines into multiple log entries
Several days ago, a Python RuntimeError was raised in one of my company's Cloud Run jobs which stopped it.
Cloud Run's logging, unfortunately, handled that RuntimeError in a bad way.
It correctly put ...
0
votes
1
answer
617
views
Using concurrency with python asyncio in requests in Google Cloud Functions
I am trying to send requests to the OpenAI API to translate a list of texts via a Google Cloud Function. Since the API takes a little while to answer and I am trying to translate a few hundred texts ...
0
votes
0
answers
65
views
Google Cloud Run: Python flask api keeps timing out
I am running a Flask app in Cloud Run, as an API service. When Cloud Run is bringing up a new instance to service an API, the Flask App is unable to service the API. From the Cloud Run console logs, ...
0
votes
1
answer
488
views
Dash app with Gunicorn doesn't start in Cloud Run
I have a Python Dash app deployed in GCP Cloud Run for reporting and analysis. The app works as it does locally, and having it in GCR allows for multiple user access at the same time and implement ...