简体   繁体   English

Google App Engine Cron为Node JS返回404

[英]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. 我正在尝试在Google App Engine中运行Cron,该引擎应每2分钟运行一次node.js脚本,但我总是在日志中收到404错误。 I see the cron is running every 2 minute but its not finding the script cronRun.js . 我看到cron每2分钟运行一次,但找不到脚本cronRun.js Below is the relevant part of the code. 以下是代码的相关部分。

cron.yaml cron.yaml

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

app.yaml 的app.yaml

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

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

log: 日志:

"GET /task" 404 “获取/任务” 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? 您是否尝试不通过Cron作业而直接向/ task端点发出请求?

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. 该问题可能与应用程序本身有关,而不是与Cron作业有关,因此我建议您通过使用/ task端点访问App Engine应用程序来对其进行测试。

If it does not work, the issue is definitely caused by the application and not Cron. 如果不起作用,则问题肯定是由应用程序而非Cron引起的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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