Encountering authorization issue when deploying Vertex AI Agent on Google App Engine

I’m stuck with a problem while trying to set up a search application. I’ve built it using Vertex AI Agent Builder and now I’m attempting to get it running on App Engine.

My setup includes a Vertex AI search app and a datastore. For the App Engine part, I’ve got a basic Flask app in main.py, an index.html file with the search widget, and a simple app.yaml configuration.

Everything seems fine at first. The app starts up, and I can click the search button. But then it goes downhill. Instead of showing search results, I get this frustrating error:

Configuration is not authorized on [my-app-url].uc.r.appspot.com

I’m scratching my head here. What could be causing this authorization problem? Has anyone run into something similar when working with Vertex AI and App Engine? Any tips on how to fix this would be super helpful!

I encountered a similar problem when deploying my Vertex AI app to App Engine. I found that ensuring proper authentication is key. First, I checked that the App Engine default service account had the necessary permissions for Vertex AI. Then I verified that my application’s credentials were correctly configured and that I was using the latest Vertex AI client library. When using a custom service account, it’s important that it is accurately specified in the app.yaml file.

I also ran the app locally using Application Default Credentials to isolate the issue. Finally, I confirmed that the Vertex AI API was enabled in my Google Cloud project. I hope these insights help resolve your authorization challenge.

I’ve dealt with similar authorization issues when deploying Vertex AI applications. One crucial step is to ensure your App Engine service account has the correct roles assigned. Specifically, check if it has the ‘Vertex AI User’ role. You can verify this in the IAM & Admin section of your Google Cloud Console. Additionally, make sure you’ve properly set up your application’s credentials. In your Flask app, you should be using google.auth.default() to obtain credentials. This method automatically detects and uses the appropriate credentials when running on App Engine. Lastly, double-check that you’ve enabled the Vertex AI API for your project. Sometimes, this step is overlooked and can cause unexpected authorization errors. If you’ve already checked these areas and are still encountering issues, you might want to review your App Engine logs for more detailed error messages.

hey jack, sounds like a real headache! have u checked ur app’s service account permissions? might need to give it access to vertex ai api. also, double-check ur project ID in app.yaml matches ur GCP project. hope this helps, lemme know if u figure it out!