Tuma
Tuma

Reputation: 807

Cloud Run service blocked from accessing another Cloud Run service in the same VPC by CORS

I have two Cloud Run services:

The problem: Service A gets blocked on preflight from accessing Service B:

blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

When I set Service B's Ingress Control to All, Service A can access it with no problem. Also, Service B does have access to Vertex via the default service account, so that's not what's causing the issue.

Here's some of the code on the Flask server:

It has basic CORS enabled:

app = Flask(__name__)
CORS(app)

Removing CORS configs makes no difference.

Looking at the logs, the frontend's requests don't even seem to reach the backend. All routes accept the OPTIONS method. Also, production is served by waitress.

There's clearly something I'm missing about the configuration, but I'm stumped. Any suggestions or just a starting point of what could be wrong would help greatly.

Upvotes: 0

Views: 90

Answers (0)

Related Questions