We are trying to deploy a Nest.js API using Vercel functions, but we are experiencing a small cold start hovering around 4 seconds. I have read a few articles about it and I have noticed that once one article even suggested us to setup a cronjob to keep hitting the API so that it never spins down, but that suggestion is not there anymore.
What do I need to know, and what do I need to do in order to either keep the service up fulltime or drastically reduce the cold start in a Nest.js API?
The configuration I'm using:
{ "version": 2, "builds": [ { "src": "src/main.ts", "use": "@vercel/node" } ], "routes": [ { "src": "/(.*)", "dest": "src/main.ts", "methods": ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] } ]}