Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

fastapi+cloud run+apigee

Hello,

I’m currently working on a project that involves several endpoints created using FastAPI. My intention is to deploy these endpoints on Google Cloud Run.

Once deployed, my goal is to manage these APIs using a service from GCP, specifically something designed for API management. My initial attempt involved using Google’s API Gateway. However, I encountered a compatibility issue: API Gateway requires the OpenAPI Specification (OAS) version 2, but FastAPI produces documentation compliant with the OpenAPI version 3. This mismatch led me to seek an alternative solution.

My next attempt was using Apigee. While I was able to follow the provided documentations to some extent and make it work, I found the instructions somewhat ambiguous and unclear. Furthermore, I ran into an error that prevented me from calling my deployed application on Cloud Run. This error occurred when I attempted to use an API proxy and set the link within Apigee.

After doing some searchs, I realized that it might be a problem with service account. In my effort to troubleshoot, I tried to add a service account and assign it the “Cloud Run Invoker” role. This role is typically responsible for permission to send requests to Cloud Run services. I attempted to add this service account during the deployment of the API proxy, but it did not yield the desired results.

When I navigated to the service account section within the GCP Console, I noticed that the roles I previously assigned were not visible. This added to my confusion. The interface presented me with a “grant access” option, but when I attempted to add the service account email and searched for the “Cloud Run Invoker” role, I was unable to find it.

This whole process has left me feeling perplexed and overwhelmed. Concepts like principals, permissions, roles, and their interplay are proving to be quite challenging to grasp in this context. I anticipated that the process would be straightforward, but I’m finding it difficult to resolve these issues on my own.

I would greatly appreciate any guidance or assistance with these challenges. Specifically, if there’s a clear and direct method for integrating FastAPI with Cloud Run and either API Gateway (despite the OpenAPI version conflict) or Apigee, that would be extremely helpful for my project. If anyone has experience with these technologies and can offer insight, it would mean a great deal to me.

2 3 4,349
3 REPLIES 3
Top Solution Authors