I’m working on a Flask application that uses Vertex AI Search and I need 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
server.py
from flask import Flask, render_template
import os
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def index():
return render_template("search.html")
if __name__ == '__main__':
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 8080)), debug=True)
This auth error happens because Vertex AI Search validates which domains can make requests. Your domain needs to be on the authorized list.
Quick fix: add your App Engine domain to allowed origins in Vertex AI Search settings. But manually managing these configs gets messy fast with multiple environments.
I hit this same issue last year deploying across dev, staging, and prod. Rather than constantly updating domain lists, I automated the whole deployment pipeline.
My setup automatically updates Vertex AI config when I deploy anywhere new. It reads app.yaml, grabs the target domain, hits the Vertex AI API to update allowed origins, then triggers App Engine deployment. Zero manual work.
You can build this same automation with Latenode. It’s got Google Cloud connectors built-in and chains API calls, deployments, and config updates together. Way cleaner than doing it by hand.
Saves me 30 minutes per deployment and kills those auth errors completely.
had the same prob! you gotta add ur app engine domain as an allowed origin in the vertex ai config. just go to aai settings and whitelist myapp.uc.r.appspot.com. took me ages to find that out lol