Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions functions/concepts/afterResponse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
'use strict';

// [START functions_concepts_after_response]
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.
*/
exports.afterResponse = (req, res) => {
functions.http('afterResponse', (req, res) => {
res.end();

// This statement may not execute
console.log('Function complete!');
};
});
// [END functions_concepts_after_response]
3 changes: 3 additions & 0 deletions functions/concepts/afterResponse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
},
"engines": {
"node": ">=12.0.0"
},
"dependencies": {
"@google-cloud/functions-framework": "^3.1.3"
}
}