Skip to content

Commit 29fc14b

Browse files
fix(cloud-tasks): add await to async function and correct endpoint path in FUNCTION_URL
1 parent ca49f40 commit 29fc14b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cloud-tasks/tutorial-gcf/app/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runtime: nodejs16
1919
env_variables:
2020
QUEUE_NAME: "my-queue"
2121
QUEUE_LOCATION: "us-central1"
22-
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/sendEmail"
22+
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/send-email"
2323
SERVICE_ACCOUNT_EMAIL: "<member>@<project_id>.iam.gserviceaccount.com"
2424
# [END cloud_tasks_app_env_vars]
2525

cloud-tasks/tutorial-gcf/app/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ const {SERVICE_ACCOUNT_EMAIL} = process.env;
2828
app.use(express.urlencoded({extended: true}));
2929

3030
// [START cloud_tasks_app]
31-
app.post('/send-email', (req, res) => {
31+
app.post('/send-email', async (req, res) => {
3232
// Set the task payload to the form submission.
3333
const {to_name, from_name, to_email, date} = req.body;
3434
const payload = {to_name, from_name, to_email};
3535

36-
createHttpTaskWithToken(
36+
await createHttpTaskWithToken(
3737
process.env.GOOGLE_CLOUD_PROJECT,
3838
QUEUE_NAME,
3939
QUEUE_LOCATION,

0 commit comments

Comments
 (0)