Hi all!
For my payload cloud app I need to run a script once daily.
What would be the best way to go about doing this? Note that it needs
ts-node
to run.
Thanks in advance!
You can use node-cron to achieve this.
https://github.com/kelektiv/node-cronYou can see an example here:
Note: On Pro tier, there are 2 instances of your app. In this case, you may need to do some extra logic to ensure that only one instance runs the cron.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.