I have the Vercel integration configured, and it all seems to work as expected.
The only thing that seems off is the build items. For a push deployment or manual redeployment, it takes about 2-3 minutes. When triggering a build from the CMS it takes about 40-60 seconds.
I log the number of “redirect” records I have during the build step. (They get added to the next.config instead of a middleware check on each request)
- When I add a new record and trigger a build manually the number increases.
- When I add a new record and trigger through the CMS, the number stays the same.
My fetch is set up to be
I am wondering if there is a way to configure the integration to trigger a deployment without using existing build cache to avoid this difference? At the moment I have to redeploy manually each time a client adds a record instead of them being able to manage it independently.
Hi @aj, and welcome to the forum!
To turn off the Vercel build cache, you can set the env var
VERCEL_FORCE_NO_BUILD_CACHE=1 in Vercel. From their docs: Managing Build Cache. You can also make a custom webhook using their deploy hooks with
?buildCache=false, if you prefer: Creating & Triggering Deploy Hooks
To get your pages to build after a content change, you can implement Incremental Static Regeneration to have Vercel automatically rebuild changed pages only, not the entire site each time.
Hope that helps!
Adding this environment variables would be a blanket change to the project. Is there a way to configure the DatoCMS integration to trigger the webhook with that URL parameter? This might be a future feature request I guess, when editing the Build Trigger in Dato, there is an additional option to “Use build cache” (set to true by default but can be turned off if needed).
The site is already set up with ISR where needed, as mentioned, I am making a request to generate redirects in the
next.config.js file, this needs to happen at build time.
I’ll use that environment variable in the meantime, cheers.
You can do that by making a custom webhook build trigger (instead of the default Vercel integration):
And then you’d follow their instructions to make a custom Vercel build hook with build cache disabled:
(You’d probably then remove the default Vercel integration from DatoCMS so you don’t end up building twice)
Does that help?