Hi all I have a python project which I've been trying to deploy on Cloud Run since 24 hours non-stop and can't get it to work. I've connected my git repo to Cloud Build with buildpacks . Since my app uses websockets I've Allowed unauthenticated invocations, CPU is always allocated, Minimum number of instances is 1 with 1GiB of Memory. It builds correctly without any errors but when I visit the link I get an Internal Server Error (500).
Error:
Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 135, in handle self.handle_request(listener, req, client, addr) File "/layers/google.python.pip/pip/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 178, in handle_request respiter = self.wsgi(environ, resp.start_response)
requirements.txt:
beautifulsoup4duckduckgo_searchfastapigoogle_cloud_aiplatformlangchainlangchain_communitylangchain_corepython-dotenvrequeststqdmuvicornfaiss-cpusentence-transformerspandasopenpyxlarxivPyMuPDFwebsockets
.env:
PROJECT_ID = "ancient-wave-414112"LOCATION = "us-central1"CONFIG_PATH = "./config.json"
main.py:
from backend.api import appfrom dotenv import load_dotenvimport osload_dotenv()if __name__ == "__main__": import uvicorn os.environ['KMP_DUPLICATE_LIB_OK']='True' uvicorn.run(app, host="localhost", port=8000)
I've tried removing the package versions and set min instances to 1 as per these solutions below but nothing worked:https://github.com/GoogleCloudPlatform/generative-ai/issues/198Google Cloud Run Gunicorn Multi-Threaded Django Request Blocked on Cold Start