Execution after HTTP response

Stay organized with collections Save and categorize content based on your preferences.

Example of code that won't execute after an HTTP response is sent.

Code sample


const functions = require('@google-cloud/functions-framework');

 * HTTP Cloud Function that may not completely
 * execute due to early HTTP response
 * @param {Object} req Cloud Function request context.
 * @param {Object} res Cloud Function response context.
functions.http('afterResponse', (req, res) => {

  // This statement may not execute
  console.log('Function complete!');

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.