diff --git a/apps/site/src/lib/utils/api.ts b/apps/site/src/lib/utils/api.ts index 4a9a0c2d2..0341bd83f 100644 --- a/apps/site/src/lib/utils/api.ts +++ b/apps/site/src/lib/utils/api.ts @@ -2,7 +2,10 @@ import axios from "axios"; import { cookies } from "next/headers"; const LOCAL_API_URL = "http://localhost:8000"; -const SERVER_HOST = process.env.NEXT_PUBLIC_VERCEL_URL; +// Important: we need to do a dynamic lookup since otherwise the environment variable +// will be inlined during build and cause faulty caching issues (see #290) +const varName = "NEXT_PUBLIC_VERCEL_URL"; +const SERVER_HOST = process.env[varName]; // The Vercel Serverless Function for the API lives outside the scope of Next.js // so the publicly deployed URL must be used instead of a rewrite diff --git a/apps/site/turbo.json b/apps/site/turbo.json index 6ddf978b5..abf62e970 100644 --- a/apps/site/turbo.json +++ b/apps/site/turbo.json @@ -2,6 +2,7 @@ "extends": ["//"], "pipeline": { "build": { + "env": ["NEXT_PUBLIC_SANITY_*"], "inputs": [ "src/**", "public/**",