Add to Cloud functions a way to check for the existence of a file (or file pattern) with either a true/false response or a simple integer count of the number of matching files in the designated location.
Also, for this and other functions that are "sourcing" a file or files (i.e., download and delete), a "wait up to n seconds" for the file to become available would be a good thing, since S3 and other cloud-based file systems can have a lag from the time a file is uploaded until it's visible to other connections.