0

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

enter image description here

Psypher
  • 10,717
  • 12
  • 59
  • 83
  • Have you tried making a request to the **/task** endpoint directly, without going through the Cron job? Maybe the problem is in your application and not in Cron. – dsesto Dec 11 '17 at 14:35
  • 1
    Possible duplicate of [404 from cron job on google app engine django app](https://stackoverflow.com/questions/45776773/404-from-cron-job-on-google-app-engine-django-app) – Dan Cornilescu Dec 11 '17 at 14:47
  • @Yandrak3 Thanks! it worked. I am very new to node js and google app engine. I never thought to check if the endpoints work. Probably you can add your comments in answer so that I can close it. – Psypher Dec 11 '17 at 16:57

1 Answers1

1

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.

dsesto
  • 7,864
  • 2
  • 33
  • 50