Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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 ...
jminardi's user avatar
  • 1,066
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 ...
sww314's user avatar
  • 1,342
15 votes
5 answers
20k views

Simplest way to perform logging from Google Cloud Run

I followed this guide https://firebase.google.com/docs/hosting/cloud-run to setup cloud run docker. Then I tried to follow this guide https://cloud.google.com/run/docs/logging to perform a simple log. ...
Zorik's user avatar
  • 247
14 votes
1 answer
7k views

Gunicorn (with Flask) parameters for Google Cloud Run (GCR) - what to put in Dockerfile? [closed]

Looking for some guidance from people with practical GCR experience. How do you get on with this? I run a Docker container (approx. 670mb in size) in Google Cloud Run, inside is my Python server based ...
Amy Wong's user avatar
  • 345
8 votes
1 answer
6k views

How to increase the memory limits in Google Cloud Run?

I'm building a simple Flask based app using Cloud Run + Cloud Firestore. There is one method that brings a lot of data, and the logs are showing this error: `Memory limit of 244M exceeded with 248M ...
marcosluis2186's user avatar
8 votes
1 answer
4k views

Google Cloud Run does not load .env file

I spend the last couple of days trying to find what I have done wrong but I am still not able to figure out because I am able to run the app locally using flask run and also using Docker using docker-...
Pierre-Alexandre's user avatar
7 votes
1 answer
16k views

Google cloud run and web scraping with selenium

I am currently trying to get a web scraping script to be used on Google Cloud to import data to the Google Sheets API. I had a quick look around and Google Cloud Run seems that it may be able to do ...
AaronS's user avatar
  • 2,335
7 votes
2 answers
2k views

Docker image deploys locally but fails on Google Cloud Run

Here is my Dockerfile: # Use lightweight Python image FROM python:3.9-slim ARG DOCKER_ENV # PYTHONFAULTHANDLER=1 - Display trace if a sefault occurs. # PYTHONUNBUFFERED=1 - Allow statements and log ...
crazysnake99's user avatar
7 votes
0 answers
2k views

Google Cloud Run with gunicorn/flask - getting intermittent 504s

I run a Flask application on Cloud Run with gunicorn and worker type gthread. On low level, this API just writes/retrieves entries from Datastore and Pubsub so all operations are light. The traffic is ...
cherry9090's user avatar
6 votes
2 answers
1k views

Cloud Run Flask API container running shutit enters a sleep loop

The issue has appeared recently and the previously healthy container now enters a sleep loop when a shutit session is being created. The issue occurs only on Cloud Run and not locally. Minimum ...
alanmynah's user avatar
  • 221
5 votes
4 answers
4k views

How can I get the user's IP-Address in my Cloud-Run Flask app?

I have a Flask app running via Google Cloud Run and I need to know the user's IP-Address. I am using gunicorn as my Server. I have tried the following code: request.remote_addr request.environ['...
nilsf's user avatar
  • 138
5 votes
1 answer
1k views

Dash app cannot find pages folder when deploying on GCP using gunicorn

I am trying to deploy my dash app which uses dash_extensions, Dash_proxy and has multiple pages in the pages folder on GCP cloud run using gunicorn but the app cannot find the pages folder. It works ...
Rexon's user avatar
  • 141
4 votes
2 answers
14k views

Docker Error - CommandError: "0.0.0.0:" is not a valid port number or address:port pair

So I have a docker file, that I intend to build and push to Google Cloud Run and it looks like this: # pull official base image FROM python:3.7-slim # set work directory WORKDIR /usr/src/app # set ...
Abhinav Bhandari's user avatar
4 votes
2 answers
4k views

Google Cloud Run: Calling from outside GCP

I'm trying to access a secure cloud run service. If I try from my machine with the SDK it works fine: curl --header "Authorization: Bearer $(gcloud auth print-identity-token)" However, I can not get ...
Dan's user avatar
  • 416
4 votes
1 answer
4k views

Where can I find python print statements in Cloud Run docker instances?

If I am running a container within Cloud Run and do a print statement in my python code. Where can I view it? Cloud logs seem to show logs for the contain itself(build, etc)? to debug my code often I ...
Lostsoul's user avatar
  • 26.1k
4 votes
2 answers
6k views

How to run a "hello world" python script with Google Cloud Run

Forgive my ignorance.. I'm trying to learn how to schedule python scripts with Google Cloud. After a bit of research, I've seen many people suggest Docker + Google Cloud Run + Cloud Scheduler. I've ...
Ben's user avatar
  • 21.8k
4 votes
1 answer
819 views

Which production server to use for Python applications in Cloud Run?

I want to use GCP cloud run as a technology to run my python flask app, so I have to dockerize it. Most of examples I've seen are either using built in flask server or gunicorn server as an ENTRYPOINT,...
alobodzk's user avatar
  • 1,334
4 votes
1 answer
2k views

Discord Bot + Google Cloud Run: "Container failed to start."

I'm attempting to deploy a simple Discord bot written in python and containerized via Docker to Google Cloud Run. The Dockerfile is very simple: FROM python:3.9 WORKDIR /app COPY requirements.txt ...
mtbell's user avatar
  • 105
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 ...
HaroldFinch's user avatar
4 votes
2 answers
2k views

How can I trigger same Cloud Run job/service using different arguments?

I'm trying to make a scrapy scraper work using cloud run. The main idea is that every 20 minutes a cloud scheduler cron should trigger the web scraper and get data from different sites. All sites have ...
xerac's user avatar
  • 195
4 votes
1 answer
5k views

Google Cloud Run - how to set 'Access-Control-Allow-Origin' header?

I'm setting up my first application on Google Cloud Run and now want to connect the server with my website. However I've run into CORS issues. I tried fixing it in my code by using flask_cors. I can ...
Theodor Bendix Gosden's user avatar
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 ...
Alex Mindock's user avatar
4 votes
0 answers
1k views

Cloud Run suddenly starts timing out when processing any request

We've been running a backend application on Cloud Run for about a year and a half now, and a month ago it suddenly stopped properly handling all requests at seemingly random times (about every couple ...
lblnd's user avatar
  • 93
4 votes
1 answer
3k views

Getting AttributeError: module 'proto' has no attribute 'module'

I'm trying to deploy a gRPC server to Cloud Run using Docker to create associated image. I am getting the following error when called: [] Traceback (most recent call last): > [] File "...
user3385136's user avatar
3 votes
4 answers
6k views

What is the current maximum timeout for a GCP Cloud Run app invoked by Cloud Scheduler

I am looking at using Cloud Scheduler to trigger daily execution of a python app on Cloud Run. The app pulls data from a third party API and inserts it into BigQuery. The only issue is, that ...
Finglish's user avatar
  • 9,996
3 votes
2 answers
2k views

Specify Python version on Cloud Run Buildpack

I am deploying a web app on Cloud Run using the automated Cloud Build "Buildpack" option (as explained here); hence not having to create a Docker File. I would like to deploy the app using ...
Alessandro Ceccarelli's user avatar
3 votes
2 answers
4k views

How to download large file from Cloud Run in Django

I have Django project on Cloud Run. When I download small file from page which has below code. def download_view(request,pk): file_path = f'media/{pk}.mp3' name = f'{pk}.mp3' with open(...
Nori's user avatar
  • 3,032
3 votes
2 answers
15k views

Cloud Endpoints returning 401 Jwt issuer is not configured

I am trying to set up service to service authentication so an external application can make requests to a Cloud Run application (behind a Cloud Endpoints API gateway). I have followed the Cloud ...
beano's user avatar
  • 952
3 votes
1 answer
2k views

Execute very long-running tasks using Google Cloud

I have been using Google CLoud for a few weeks now and I am facing a big problem for my limited GCP knowledge. I have a python project whos goal is to "scrape" datas from a website using it'...
FairPluto's user avatar
  • 737
3 votes
1 answer
1k views

Initialise fastapi web service fully before listening on port

I have a fastapi web app which is running inside of a docker container. The web app hosts multiple machine learning models which on startup it needs to read into memory. This process can take around ...
dendog's user avatar
  • 3,368
3 votes
2 answers
1k views

After adding nltk.download('words') Google Cloud Run

I have a Google Cloud Run app run on GCP. After adding the following modification, the app crashed: nltk.download('stopwords') nltk.download('averaged_perceptron_tagger') nltk.download('...
Bill Chen's user avatar
  • 1,749
3 votes
2 answers
531 views

Testing Cloud Run for a Non HTTP use usecase

I'm just getting started with GCP and starting to explore cloud run a bit. I'm using cloud run for NON HTTP purpose, i.e that I do not want to build a web application.I'm simply trying to take a ...
rishab ajain445's user avatar
3 votes
2 answers
597 views

Google Cloud Run for Anthos (Knative) not setting X-Forwarded-Proto header correctly on https requests

I have a django application running in Google cloud run (in a Kube cluster), via Docker served by uwsgi (but I've tried manage.py runserver and it's the same). By default cloud run accepts connections ...
Paul Collingwood's user avatar
3 votes
1 answer
1k views

Create a cloud run job which shares code with a cloud run service

I see google cloud run now has jobs which is amazing! What I would like to achieve is to have a main container serving web traffic and also a job container which can be activated based on some ...
dendog's user avatar
  • 3,368
3 votes
3 answers
3k views

How can I grant a Cloud Run service access to service account's credentials without the key file?

I'm developing a Cloud Run Service that accesses different Google APIs using a service account's secrets file with the following python 3 code: from google.oauth2 import service_account credentials = ...
TheChouzanOne's user avatar
3 votes
1 answer
864 views

Why does sqlite (read-only) work running in Docker locally but not in Google Cloud Run?

I have a substantial sqlite database file (~2 million rows) which I query in a Rust application using rusqlite on Google Cloud Run, using a bundled version of sqlite. I do not add or write data, and ...
fizzbucket's user avatar
3 votes
1 answer
678 views

gRPC API server via Python can't worked

I have developed the gRPC API server via Python, Then build it to container and deploy on Cloud Run, Which my gRPC server are integrating with TensorFlow application. Actually the tensorflow for image ...
zzob's user avatar
  • 1,154
3 votes
0 answers
1k views

Docker on Google Cloud Run - Python Multiprocessing: OSError: [Errno 38] Function not implemented

I'm running a simple python web scraping script within a docker container on Cloud Run, it is invoked from the Cloud Scheduler and gives an error: File "/usr/local/lib/python3.8/multiprocessing/...
Dan's user avatar
  • 416
3 votes
0 answers
3k views

unable to run selenium chrome-driver on google-cloud-run

I have a docker container that runs a working selenium chrome driver script, however when the same image is deployed to Google Cloud Run I encounter the following error. webdriver.Chrome('/home/...
Fry's user avatar
  • 73
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....
Raimundo Manterola's user avatar
2 votes
2 answers
2k views

Do I need to clean/remove the images created on deployments of my Cloud Run instance?

I have a Cloud Run instance up and running on my Google Cloud Platform project. Whenever I do any changes to my main.py file, I perform the following steps: gcloud builds submit --tag ${CONTAINER} ...
Luiscri's user avatar
  • 1,057
2 votes
2 answers
2k views

Tracing a Python gRPC server deployed on Cloud Run with OpenTelemetry

I'm running a Python gRPC server on Cloud Run and attempting to add instrumentation to capture trace information. I have a basic setup currently, however I'm having trouble making use of propagation ...
dkhaupt's user avatar
  • 2,358
2 votes
2 answers
789 views

Cloud Run / Docker loading large files for ML prediction

I am trying to serve a fairly large model (1GB) from a Flask powered docker container on Google Cloud Run. I am trying to figure out the best way load the pickle / joblib model files - so as to reduce ...
dendog's user avatar
  • 3,368
2 votes
2 answers
3k views

Accessing and using csv file from Cloud Storage in Cloud Run instance

I know how to download the file from cloud storage within the cloud run instance. But, I can't find the syntax for reading the file in python. I'm looking to immediately convert the csv file into a ...
noname's user avatar
  • 123
2 votes
1 answer
2k views

Cloud Run Client Request IP address gets overridden by proxy Python Fast API

There is an issue of getting real user request IP address inside web application that is running on Cloud Run service. By some reason the web application obtains the same IP address for all users ...
Andrii's user avatar
  • 81
2 votes
1 answer
2k views

How do I run my Cloud Run service locally?

I have the following simple Cloud Run service from the Python quickstart: app.py: import os from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello ...
Dustin Ingram's user avatar
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. ...
geometricfreedom's user avatar
2 votes
1 answer
389 views

Django app on Cloud Run infinite redirects (301)

I am trying to deploy a Django app in a container to Cloud Run. I have it running well locally using Docker. However, when I deploy it to Cloud Run, I get infinite 301 redirects. The Cloud Run logs do ...
Basley's user avatar
  • 89
2 votes
2 answers
881 views

Python script scheduling on google cloud

I'm facing this issue where i have a python script that needs to be run every day at 00:00am on google cloud, possibly using Google Cloud Run, what I'd like to know is something quite specific to ...
Roberto Montalti's user avatar
2 votes
1 answer
3k views

Failed to install jsonnet on google cloud run

I am trying to build a image for deploying a code on google cloud run with the jsonnet python package, it fails to install jsonnet with following error. Any ideas what can I do to resolve this? ...
Duumb Eeee's user avatar

1
2 3 4 5 6