From b3443cd22dfb7a041bf173f371ef54a09f6007d9 Mon Sep 17 00:00:00 2001 From: zomars Date: Fri, 2 Dec 2022 18:39:30 -0700 Subject: [PATCH] Revert fix --- lib/helpers/customPrisma.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/helpers/customPrisma.ts b/lib/helpers/customPrisma.ts index 255ddc509a..075875aaf0 100644 --- a/lib/helpers/customPrisma.ts +++ b/lib/helpers/customPrisma.ts @@ -18,8 +18,11 @@ export const customPrismaClient: NextMiddleware = async (req, res, next) => { await next(); return; } + // If we have a key, we check if the deployment matching the key, has a databaseUrl value set. - const databaseUrl = await fetch(`${CONSOLE_URL}/api/deployments/database?key=${key}`) + const databaseUrl = await fetch( + `${process.env.NEXT_PUBLIC_CONSOLE_URL || CONSOLE_URL}/api/deployments/database?key=${key}` + ) .then((res) => res.json()) .then((res) => res.databaseUrl);