Search code examples
google-cloud-platformscheduled-tasks

How to schedule http request in Google Cloud more than 30 days?


In my current project I need develop functionality with execution http request more than 30 days. For example in the same day on next year. I try to use Google Task, but receive this error message "Uncaught Error Error: 3 INVALID_ARGUMENT: The Task.scheduleTime, 2024-11-30T15:00:00-08:00, is too far in the future. Schedule time must be no more than 720h in the future."

There is, of course, functionality Google Schedule task, but this is extremely usefulness functionality, for my opinion, because:
(1) I don't see clear example how to create Scheduled task programmatically, only manually in Google Console
(2) This functionality is expensive, I need thousands job and potentially up to millions
(3) This functionality has extremely strange billing, for account and not for project! I'm not owner of project I programming, I'm developer, one of many and many. And why I must attach this functionality to my personal Google account at all? Also I must checking in runtime source of request and service account what will created request (analyze headers and so on). Why I must using for analyzing something other then project service account? If I will fires from current company, project must be changing? It's extremely strange to bind Schedule task for my own Google account instead project account.

Google rules

So, how is possible resolve my project workflow? Firstly, with something Google functionality like Google Task or Google Firebase. And secondary, is it possible upload to Google Cloud code with something library like https://www.npmjs.com/package/quartz-scheduler - is this functionality will working stable in Google Cloud? With long term delay, at least year and with thousands scheduled task?


Solution

    1. I provided a response to your post on Google Cloud Community

    ...You can solve your underlying problem by using 2 tasks.

    Imagine you have a function you want to run in 40 days

    a) You schedule Task 1 to run in say 25 days from now.

    b) In 25 days, Task 1 kicks off and simply calls another endpoint which then creates a new task (Task 2) scheduled to run 15 days (40 -25) from that day

    1. I just found this stackoverflow response from someone who says they use that principle and it works for them