I’m working on a Flask web application that uses Google Cloud Vertex AI Search functionality and I want to host it on App Engine. Everything seems to work fine locally but when I deploy to production I get an authorization issue.
My Flask application structure:
server.py
from flask import Flask, render_template
import os
webapp = Flask(__name__)
@webapp.route("/", methods=['GET', 'POST'])
def homepage():
return render_template("search.html")
if __name__ == '__main__':
webapp.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8080)), debug=True)
When I click the search input field, it opens the Vertex AI search interface but then displays this error message:
Configuration is not authorized on “***.uc.r.appspot.com”
The search widget works perfectly in my local development environment. Has anyone encountered this authorization problem when deploying Vertex AI search components to App Engine? What configuration steps am I missing?
This authorization error typically occurs because your Vertex AI search configuration has domain restrictions that don’t include your App Engine deployment URL. I encountered similar issues when deploying search widgets to production environments. The search widget validates the requesting domain against a whitelist defined in your configuration. Since your local environment works fine, the configuration likely only authorizes localhost or your development domain. Your App Engine domain needs explicit authorization. Access the Vertex AI Search configuration through the Google Cloud Console and locate your search app by the config ID. In the configuration settings, there should be an authorized domains or allowed origins section where you can add your App Engine URL. Make sure to include the full domain including the protocol. One additional consideration is that if you’re using the default App Engine domain, it might change between deployments in some cases. Consider setting up a custom domain mapping for more consistent access control. Also verify that your project’s Vertex AI APIs are properly enabled for the App Engine service account.
yep this is definitly a domain whitelist thing. i had the same issue last week and it drove me crazy for hours lol. your vertex ai search config is blocking the appengine domain cause its not in the approved list. just go to the vertex ai console and add your *.uc.r.appspot.com domain to the authorized domains section.
Had this exact headache a few months back when moving our internal search tool to production. The problem isn’t with your Flask code or App Engine configuration - it’s all about the Vertex AI search widget domain restrictions.
What’s happening is your search widget configuration was created with domain allowlisting that only includes localhost or your development environment. When App Engine serves your app, it’s running from a different domain that hasn’t been whitelisted.
You’ll need to update the search widget configuration to include your App Engine URL. Go into the Vertex AI Search console, locate your search app using that config ID, and update the allowed domains section. Don’t forget that App Engine URLs can change if you’re using the default domain, so you might want to consider setting up a custom domain for stability.
One thing that caught me off guard was that changes to domain authorization can take a few minutes to propagate, so don’t panic if it doesn’t work immediately after updating. Also worth noting that you can add multiple domains if you have staging environments.
Quick fix that worked for me when I hit this same wall a couple times. The domain authorization is the culprit here, but there’s a faster way to handle this.
Instead of hunting through the Vertex AI console menus, just grab your App Engine URL and add it directly through the API or the search configuration editor. But here’s the thing that saved me time - you can actually use wildcards in the domain configuration.
So instead of adding just your specific App Engine URL, add both:
*.uc.r.appspot.com (if you want to cover multiple versions)
This way you won’t have to update the config every time you deploy a new version. I learned this the hard way after updating domains three times in one week.
One more thing - if you’re still getting auth errors after updating the domains, clear your browser cache or test in incognito. The widget sometimes caches the old authorization response and you’ll think your fix didn’t work when it actually did.
Been there, done that. This is a classic domain authorization issue with Vertex AI search widgets.
Your search widget config is only authorized for specific domains, and your App Engine domain isn’t in that list. When you created the search widget configuration, it was probably set up for localhost only.
Here’s what you need to do:
Go to your Google Cloud Console
Navigate to Vertex AI Search and Conversation
Find your search widget configuration (the one with ID 98b41027-yyyy-yyyy-yyyy-yyyy90c6yyyy)
Edit the configuration and add your App Engine domain to the authorized domains list
Add both your current domain (something.uc.r.appspot.com) and consider adding your custom domain if you plan to use one
I ran into this exact same problem last year when deploying a similar search interface. The error message is pretty clear once you know what to look for - it’s basically saying “this domain is not allowed to use this search configuration”.
Also make sure your service account has the proper IAM permissions for Vertex AI if you’re doing any backend operations.
This tutorial covers the whole setup process including domain configuration: