diff --git a/cloud-tasks/tutorial-gcf/app/app.yaml b/cloud-tasks/tutorial-gcf/app/app.yaml index c0edee0fe7..3000644a42 100644 --- a/cloud-tasks/tutorial-gcf/app/app.yaml +++ b/cloud-tasks/tutorial-gcf/app/app.yaml @@ -19,7 +19,7 @@ runtime: nodejs16 env_variables: QUEUE_NAME: "my-queue" QUEUE_LOCATION: "us-central1" - FUNCTION_URL: "https://-.cloudfunctions.net/sendEmail" + FUNCTION_URL: "https://-.cloudfunctions.net/send-email" SERVICE_ACCOUNT_EMAIL: "@.iam.gserviceaccount.com" # [END cloud_tasks_app_env_vars] diff --git a/cloud-tasks/tutorial-gcf/app/index.js b/cloud-tasks/tutorial-gcf/app/index.js index 97aea3b640..8dbae109d9 100644 --- a/cloud-tasks/tutorial-gcf/app/index.js +++ b/cloud-tasks/tutorial-gcf/app/index.js @@ -28,12 +28,12 @@ const {SERVICE_ACCOUNT_EMAIL} = process.env; app.use(express.urlencoded({extended: true})); // [START cloud_tasks_app] -app.post('/send-email', (req, res) => { +app.post('/send-email', async (req, res) => { // Set the task payload to the form submission. const {to_name, from_name, to_email, date} = req.body; const payload = {to_name, from_name, to_email}; - createHttpTaskWithToken( + await createHttpTaskWithToken( process.env.GOOGLE_CLOUD_PROJECT, QUEUE_NAME, QUEUE_LOCATION,