The most important and overlooked concept is that of timeout in cloud functions on the GCP
Google recommends to have a timeout of 60 seconds in cloud functions which is a fair value.
So, next time you get an error that you are unable to deploy your cloud function because your function has timed out. Be sure to increase the value of timeout in your cloud function.