Cloud 函式概念:函式終止

在 Node 中發出函式終止信號

程式碼範例

Node.js

如要驗證 Cloud Run 函式,請設定應用程式預設憑證。 詳情請參閱「為本機開發環境設定驗證」。

// Await-ing promises within functions is OK if you don't return anything
await Promise.resolve();

// These will cause background tasks to stop executing immediately
return 1; // OK: returning a value

// These will wait until the related background task finishes
return Promise.resolve(); // OK: returning the promise itself
return await Promise.resolve(); // Same as above
return Promise.reject(); // OK: same behavior as to-be-resolved promises
return await Promise.reject(); // Same as above

後續步驟

如要搜尋及篩選其他 Google Cloud 產品的程式碼範例,請參閱Google Cloud 範例瀏覽器