简体   繁体   中英

Google app engine cron returning 404 for node js

I am trying to run a cron in google app engine which should run a node.js script every 2 minute but i always get 404 error in the log. I see the cron is running every 2 minute but its not finding the script cronRun.js . Below is the relevant part of the code.

cron.yaml

cron:
- description: "daily summary job"
  url: /task
  schedule: every 2 minutes

app.yaml

runtime: nodejs
env: flex
api_version: 1
threadsafe: true

handlers:
- url: /task
  script: cronRun.js

log:

"GET /task" 404

By this I see that I am not defining the path correctly.

Below is the file structure

在此处输入图片说明

Have you tried making a request to the /task endpoint directly, without going through the Cron job?

The problem may be related to the application itself and not the Cron job, so I would recommend you to test it by accessing your App Engine application with the /task endpoint.

If it does not work, the issue is definitely caused by the application and not Cron.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM