App Engine deployment shows 'Configuration is not authorized' when integrating Vertex AI search widget

I’m working on a Flask application that uses Vertex AI Agent Builder for search functionality and want to deploy it to Google App Engine. Everything works fine locally, but when I deploy to App Engine I get an authorization error.

My Flask application structure:

server.py

from flask import Flask, render_template
import os

web_app = Flask(__name__)

@web_app.route("/", methods=['GET', 'POST'])
def home():
    return render_template("search.html")

if __name__ == '__main__':
    web_app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8080)), debug=True)

search.html

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="UTF-8">
    <title>Company Search Portal</title>
  </head>
  <body>
    <h1>Internal Document Search</h1>
    <script src="https://cloud.google.com/ai/gen-app-builder/client?hl=en_US"></script>
    
    <gen-search-widget
      configId="42b73024-yyyy-yyyy-yyyy-yyyy91b6yyyy"
      triggerId="searchTrigger">
    </gen-search-widget>
    
    <input placeholder="Enter search terms" id="searchTrigger" />
  </body>
</html>

app.yaml

runtime: python39

The Flask app starts successfully on App Engine. When I click the search input field, it opens the Vertex AI search interface correctly. However, as soon as I try to perform a search, I get this error message:

Configuration is not authorized on “my-project.uc.r.appspot.com

I’ve set up my Vertex AI search engine and datastore properly in the console. The search widget works perfectly when testing locally. What configuration steps am I missing for the App Engine deployment? Do I need to add specific permissions or modify the app.yaml file?

This is a super common issue with Google Cloud - domain authorization is blocking your App Engine domain from using the Vertex AI search widget.

Google makes you whitelist domains that can use your search config. Your local dev works because localhost is usually allowed by default, but App Engine domains need explicit authorization.

Go to your Vertex AI Agent Builder console, find your search app config, and add your App Engine domain (my-project.uc.r.appspot.com) to the allowed domains list. Look for “Domain restrictions” or “Authorized domains” in your search app settings.

Honestly though, this deployment headache is exactly why I stopped dealing with complex cloud service integrations directly. Instead of wrestling with domain authorizations and service configs, I built a simple automation that handles all the Vertex AI interactions through API calls.

The automation takes search requests from your Flask app, makes the proper API calls to Vertex AI with the right credentials, and returns formatted results. No domain restrictions, no widget authorization issues, and way better control over the search experience.

You can easily add features like search logging, result filtering, or custom formatting without being stuck with the widget’s limitations.

Check out how to set this up: https://latenode.com