The fix was to add the following to layouts.js:
layouts.js
export const dynamic = "force-dynamic";
Here is the PR with the fix.
I got this solution after contacting DigitalOcean support.