Subscription expiry with Cloud Functions Pub/Sub Trigger
I've noticed an issue when a cloud function is triggered by pub/sub. When the function is deployed, a subscription is created but the expiry is set to 31 days. This means that if no messages are received for that time, the subscription disappears. After that the function appears to be deployed but will never do anything. Presumably the subscription should last as long as the function does, and be deleted if the function is removed.
A further problem is that attempting to change the expiry time doesn't work. I tried:
gcloud beta pubsub subscriptions update [subscription name removed] --expiration-period=never
I then got an error:
ERROR: (gcloud.beta.pubsub.subscriptions.update) INVALIDARGUMENT: The supplied HTTP URL is not registered in the subscription's parent project (url="[url removed]", projectid="[project id removed]").
For now I'll just make sure something is posted to the queue regularly (the service is being tested and doesn't have regular traffic yet) but hopefully this report is helpful.