Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

chore: Improve prisma and api debugability (#3784)

Ivan Starkov2114168044ee
diff --git a/apps/builder/app/routes/rest.patch.ts b/apps/builder/app/routes/rest.patch.ts
index d0244520de..03f3dfc2cc 100644
--- a/apps/builder/app/routes/rest.patch.ts
+++ b/apps/builder/app/routes/rest.patch.ts
@@ -334,8 +334,11 @@ export const action = async ({ request }: ActionFunctionArgs) => {
}
return { status: "ok" };
- } catch (e) {
- return { errors: e instanceof Error ? e.message : JSON.stringify(e) };
+ } catch (error) {
+ console.error(error);
+ return {
+ errors: error instanceof Error ? error.message : JSON.stringify(error),
+ };
}
};
diff --git a/apps/builder/app/shared/context.server.ts b/apps/builder/app/shared/context.server.ts
index 465efd55ea..61d6a210c5 100644
--- a/apps/builder/app/shared/context.server.ts
+++ b/apps/builder/app/shared/context.server.ts
@@ -87,7 +87,9 @@ const createUserPlanContext = async (request: Request) => {
}
const user = await authenticator.isAuthenticated(request);
- const planFeatures = user?.id ? getUserPlanFeatures(user.id) : undefined;
+ const planFeatures = user?.id
+ ? await getUserPlanFeatures(user.id)
+ : undefined;
return planFeatures;
};
diff --git a/packages/prisma-client/src/prisma.ts b/packages/prisma-client/src/prisma.ts
index 2034aadd21..35bc2b0739 100644
--- a/packages/prisma-client/src/prisma.ts
+++ b/packages/prisma-client/src/prisma.ts
@@ -81,7 +81,22 @@ export const prisma =
},
],
}
- : {}),
+ : {
+ log: [
+ {
+ emit: "stdout",
+ level: "error",
+ },
+ {
+ emit: "stdout",
+ level: "info",
+ },
+ {
+ emit: "stdout",
+ level: "warn",
+ },
+ ],
+ }),
});
prisma.$on("query", (e) => {