I was at the point in my Shopify app development career where I need to run some Cron Jobs on my applications. This proved to be a little bit more res

Cron & Scheduled Jobs in Remix Shopify Apps

submited by
Style Pass
2024-10-14 14:00:04

I was at the point in my Shopify app development career where I need to run some Cron Jobs on my applications. This proved to be a little bit more research intensive than I had originally thought. There really isn't a standard way that Remix or Shopify recommends you to follow. Normally this wouldn't be a problem, I'd just fire up my terminal and install node-cron, set up the cron schedule and be on my way. However, this won't really work well with my current infrastructure setup. Here's my setup:

So how do we address these problems? We can utilize a third party service that will call an API route in our Remix application on a CRON schedule. This will ensure that even if our machine is turned off it will turn on to process the request, and only a single machine will process that request. There are a ton of third party solutions that you could use to achieve this: Upstash, Trigger.dev, Quirrel, or even Github Actions. You could also write your own service on a VPS that could accomplish this.

I really wanted to use Quirrel at the start of this, however their manage service is no longer a thing and you would have to self host the app yourself. Development also seems to have stopped for it. In this article we will be using Upstash because it is extremely simple and has a great free tier.

Leave a Comment