apigoogle-cloud-pubsubgoogle-cloud-run

On Google Run how does a service know to be invoked by Google Pub/Sub if the endpoint has a different URL?


Hi this is mainly a Question on how Pub/Sub can invoke a service on google run while not having an identical subscription endpoint to the service.

Going to post the image of a url of a Google Run URL to invoke the service(im assuming it invokes the service from that url) and a Subscription endpoint so that the message can invoke the google runs service.

more context is that on the post method the route does have /processedvideos at the end of it i just don't know how it can call a service without an identical URL to google run if im making any sense. Google run service URL

Subscription Endpoint URL with /processedVideos attached


Solution

  • Pub/Sub can invoke a Cloud Run service as long as the subscription's push endpoint is a valid URL that the service can handle. The endpoint doesn't need to match the Cloud Run service's base URL exactly—it just needs to route correctly. If Pub/Sub sends messages to the root URL, the service must internally handle or forward them to /processedvideos. Alternatively, you can set the push subscription endpoint to https://your-service-xyz.a.run.app/processedvideos directly, as demonstrated in your example.