Conceptos de funciones de Cloud Functions: resolución de funciones

Señalizar la finalización de una función en Node

Código de ejemplo

Node.js

Para autenticarte en las funciones de Cloud Run, configura las credenciales predeterminadas de la aplicación. Para obtener más información, consulta el artículo Configurar la autenticación en un entorno de desarrollo local.

// 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

Siguientes pasos

Para buscar y filtrar ejemplos de código de otros Google Cloud productos, consulta el Google Cloud navegador de ejemplos.