Skip to content
Closed
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
2 changes: 1 addition & 1 deletion cloud-tasks/tutorial-gcf/app/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runtime: nodejs16
env_variables:
QUEUE_NAME: "my-queue"
QUEUE_LOCATION: "us-central1"
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/sendEmail"
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/send-email"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct: the Cloud Run function URL ends in /sendEmail; the app.post() seen below in the diff is the App Engine endpoint.

Suggested change
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/send-email"
FUNCTION_URL: "https://<region>-<project_id>.cloudfunctions.net/sendEmail"

SERVICE_ACCOUNT_EMAIL: "<member>@<project_id>.iam.gserviceaccount.com"
# [END cloud_tasks_app_env_vars]

Expand Down
4 changes: 2 additions & 2 deletions cloud-tasks/tutorial-gcf/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading