Will we ever be able to use PubSub PULL notifications with Cloud Run and Cloud Functions? What's the best alternative?

103 views
Skip to first unread message

Daniel Craggs

unread,
Nov 24, 2021, 8:58:27 PM11/24/21
to pubsub-discuss
Hi there,

I know right now that you cannot use pull pubsub notifications to start a Cloud Function or Cloud Run. What will happen is your service will shut down if there's no HTTP traffic and won't start up again since a pull notification doesn't "wake it up".

So the usual solution is to make your pubsub a push notification which means that it sends an HTTP request to your function or Cloud Run instance, which will wake it up.

However, it would be nice not to expose any REST endpoints on my services. My ideal situation would be having a Cloud Run app that will start when there are any messages pending on a defined subscription.

I realise that at minimum, GCP needs to be aware of which Cloud Run/Functions are associated to subscription. So I wondered if this is something we will ever see happening?

I have contemplated having a 2nd subscription listener who would wake up the appropriate service with a simple wake up HTTP call. But it's not the cleanest solution I can think of.

Interested to hear other thoughts on this.

Paula Gallucci Zurita

unread,
Dec 8, 2021, 3:52:11 AM12/8/21
to pubsub-discuss

Hi,

Please, bear in mind that a pull subscription is a call that you make to a Pub/Sub topic in order to recover the pending messages, so the idea of triggering a Cloud Run or a Cloud Function with a pull subscription is hard to understand from my end. Would you mind clarifying it further? 

About the ‘would be nice not to expose any REST endpoints on my services’, I’m not sure about what you are referring to. If you are concerned about the possibility of other people using your endpoint, you are able to configure authentication on your endpoint by using service accounts, this will protect your endpoint from external callers. Also, if you want to configure Pub/Sub as the only caller to your Cloud Run service, another option is only allow the internal traffic and configure an Eventarc trigger. Could you clarify this part too?

Kind regards.
Reply all
Reply to author
Forward
0 new messages