简体   繁体   中英

Do "HttpError"s cause cold starts in Google Cloud callable functions?

this google cloud functions documentation says

Uncaught exceptions or executions that crash the process can result in cold starts

Does that also apply to callable functions, defined with functions.https.onCall ? My understanding is that the proper way to handle failures was to thow an HttpsError , eg, throw new HttpsError("failed-precondition", "...")

Am I incorrect in that, or are HttpsError s handled differently? What about other uncaught errors? Are they logged in cloud functions logs, or just returned to the user?

Thanks!

I would fully expect that HttpsError is internally caught by the functions framework so that it can execute code to issue the correct response to the caller. You can examine the source code yourself here .

The point that the documentation is trying to make is essentially that uncaught exceptions could mean something truly disastrous happened, and that it's not safe to leave the server instance around any more to serve further requests. Therefore, another server instance might take its place on the next request if needed, causing a cold start. If you want to minimize cold starts, you should strive to capture non-fatal errors and decide for yourself if they warrant a server restart.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM