Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL (#21682)

Alex van Andel07ffc3fade94
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 7f5e657b3c3..255c1c2a2bd 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -48,10 +48,6 @@ if (!process.env.EMAIL_FROM) {
if (!process.env.NEXTAUTH_URL) throw new Error("Please set NEXTAUTH_URL");
-if (!process.env.NEXT_PUBLIC_API_V2_URL) {
- console.error("Please set NEXT_PUBLIC_API_V2_URL");
-}
-
const getHttpsUrl = (url) => {
if (!url) return url;
if (url.startsWith("http://")) {
@@ -335,10 +331,6 @@ const nextConfig = {
].filter(Boolean);
let afterFiles = [
- {
- source: "/api/v2/:path*",
- destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
- },
{
source: "/org/:slug",
destination: "/team/:slug",
@@ -375,6 +367,13 @@ const nextConfig = {
}, */
];
+ if (Boolean(process.env.NEXT_PUBLIC_API_V2_URL)) {
+ afterFiles.push({
+ source: "/api/v2/:path*",
+ destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`,
+ });
+ }
+
return {
beforeFiles,
afterFiles,