title: Google Cloud Functions to only Ack Pub/Sub on success (Problem resolved by GCP)
body: <p>An early version of Google Cloud Functions had a limitation with regards to retries when errors occurred.  They have since provided enhancements that resolve this issue.</p>
  <hr />
  <p>We are using a cloud function triggered by Pub/Sub to ensure delivery of an e-mail.  Sometimes the e-mail service takes a long time to respond and our cloud function terminates before we get an error back.  Since the message has already been acknowledged our e-mail gets lost.</p>
  <p>The cloud function appears to be sending an ACK the Pub/Sub message automatically when we are called.  Is there a way to delay the ACK until the successful completion of our code?  Alternatively is there a way to catch timeouts and requeue the message for delivery?  Something else we could try?</p>